Let's suppose we have a question Q1 like:

I know that when we do X, Y happens, and so you get Z. So, How can I use X to get W?

This question contains answers on how to get W by using X.

Now, we have a question Q2 like:

Why do I get Z on doing X?

The simple answer would be:

Because Y happens.

No answer in Q1 contains the answer to Q2.
So, is it OK to close Q2 as a duplicate of Q1 when the question contains the answer?

A similar thing happened to me a few months ago, when my question was closed like this.

Since I see close votes saying "unclear what you are asking", I shall now explain with a "real-world example" as DavidPostill says.

Suppose there is a question Q1 :

I know that when we use str.split("[0-9]") on a string, it gets split up into parts, if there are any numbers in the string, as [0-9] is a regular expression which matches any single digit. Here, it matches 0 and 9, thereby splitting the String into three parts, i.e, "a[", "-", and "]b". So, how can I use split() to split a String with the exact sequence "[0-9]". Like:
"a[0-9]b".split(??) => {"a","b"}

This one has answers like:

You can do: "a[0-9]b".split("\\Q[0-9]\\E")

Now there is a question Q2 like:

When I do "a[0-9]b".split("[0-9]"), why do I get {"a[","-","]b"} instead of {"a","b"} ?

And the answer to this one would be :

This is because [0-9] is a regular expression which matches any single digit. Here, it matches 0 and 9, and splits your String into three parts, i.e, "a[", "-", and "]b".

So, now you can see that answers of Q1 do not answer Q2, but the question Q1 does answer Q2.
So, would it be right to close Q2 as a duplicate of Q1?

  • (For your example, it was closed as the wrong duplicate. I left a comment there) – Tunaki Apr 17 '16 at 13:45
  • 5
    Your example is hard to understand (all those W, X, Y and Zs). Can you provide a real world example of Q1 and Q2? Your example of Why does a HTTP URL in Java compile? appears to be a Q1 that has been correctly closed as a Q2 which is the other way around from what you say in this question. I'm very confused and now my brain hurts :/ – DavidPostill Apr 17 '16 at 15:15
  • @Tunaki Yes. I agree with that one. And so, since you are a gold badge user, can you not make it correct? – dryairship Apr 18 '16 at 11:28
  • @DavidPostill See the edit. – dryairship Apr 18 '16 at 11:49
  • With your real example, then "So, would it be right to close Q2 as a duplicate of Q1?" is No (Q1 does not answer the Why of Q2). – DavidPostill Apr 18 '16 at 11:55
  • IMHO if there isn't an answer on the question you are using to close as a dupe then it is not appropriate. For me it goes along the same rational that you need an up voted answer on the dupe target in order to use it. The question needs useful answer that answers the question. – NathanOliver Apr 18 '16 at 11:58
  • 1
    "So, is it OK to close Q2 as a duplicate of Q1 when the question contains the answer?" Your question was hard to understand until this line, consider putting it (or a variation of it) at the top and/or as the question title. – Shelvacu Apr 19 '16 at 0:27
  • 1
    I'd suggest editing the title to Marking a question as a duplicate of a question when the other question is itself the answer as 'contains' makes it sound like the QA contains an answer, which is what a normal duplicate generally is... – Troyseph Apr 19 '16 at 9:00
  • You are looking for this meta.stackoverflow.com/q/292329/792066 – Braiam Apr 20 '16 at 14:40

I'm fairly sure this has been answered before. But no, for a question A to be marked as duplicate of question B, the questions A and B must be more or less the same, and the answer(s) to question B must answer the question from question A.


I believe we should be more careful about closing questions as duplicates.

I've seen several times (I'll try to find a specific example) where a questioner gets referred to a similar question whose answer, with just a little interpretation, answers the OP's question. But I feel this is fallacious, and is often a disservice to the OP.

For almost any question anyone can ask, on almost any topic, there's probably some information out there on the net somewhere which, with a little interpretation, answers the question. But people who ask questions aren't looking for puzzles, they're looking for answers! And although it may be obvious to an expert how a referenced answer can also solve a related question, it may be a complete mystery to the less-experienced user asking the related question.

So, please, if it's really exactly the same question, go ahead and mark it as a dupe, but otherwise, maybe it's okay to spin up some new answers tailored specifically to the variation on the question that's just been asked.

  • There is not a lack of questions and not a lack of answerers, but good questions and good answers are extremely rare. It should not become our problem that the average asker cannot add one and one together when the linked duplicate's answers really contain all information they need. I often leave a comment like "See duplicate, you need to do so-and-so" and that's it. We don't need yet another incarnation of the same answer that's on the site plenty of times already. Every repeated answer lacks information that canonical duplicates do contain. – CodeCaster Apr 20 '16 at 10:23

One of the huge consideration imo is searchability and also the semantic of the site. When you are asking a question or checking if questions haqve been asked you use the question. You cannot seriously expect someone to look in the body of every vaguley related question and spend time parsing complex logic to se that it has already been asked.

Id say that these shuoldn't be marked as dupes because you can argue that a ton of this stuff is known a priori, which is basically where this could go unchecked. Most questions could already be closed as dupes of RTFM

Just because one question contains an answer to another due to inverse - or worse itself being a compound question doen not mean that the inverse or the single question shouldnt be answered on its own. If anything the original question shuold be cut into parts.

  • In your first paragraph, are you answering the question "should it be closed as a dupe", or the question "should it be deleted as a dupe"? What you say about about searchability and checking other questions would mean we should close as a dupe, because a closed dupe has a direct link to the specific question that answers it. Thus someone who happens upon it is directed to their answer, without having to search further. – Dan Getz Apr 20 '16 at 14:44
  • yes fair comment on close vs delete. You are right then imo. – John Nicholas Apr 20 '16 at 17:38

You should use "Close as duplicate" if the banner text "Your question has already been answered " is correct.

Which, when another question contains the answer (including sufficient explanation) for the newer question, is met.

Note that someone else having not been confused by this isn't sufficient, the other question has to contain enough explanation of the behavior being asked about to be considered an answer to the newer question. But then, yes you can flag as a duplicate.


The questions don't necessarily need to match. Quite often, you get questions of the nature:

"What is wrong with programming feature x? When I use it, the program crashes."

But then it turns out that the actual bug is not related to feature x at all, but rather to feature y. The correct answer is: "x misbehaves because you don't understand how to use y. Use y like this: ...". Almost every crappy beginner mistake FAQ looks like this.

It is then perfectly fine to close it as a duplicate to the canonical FAQ, even though the questions are completely different.

Real world example with C++:

"What is wrong with cout? I try to print an integer with it but it prints unexpected garbage."

std::cout << i;

And then another question goes like:

"This code gives i value 5 but I arrogantly demand that it gives value 6! Is my compiler broken?"

   int i=5;

It would be correct and encouraged moderator practice to close both of these questions as canonical duplicates to Undefined behavior and sequence points. As you can see, the two made-up questions above are quite different from the one in the canonical duplicate.

  • This can be the right course of action but it's rare. One example is the popular .NET NullReferenceException question. All dupes are different but the issue is the same. That's good enough to get this crap out of sight and close it. Really, all these questions are what we formerly closed as "too narrow" before that was disallowed. – boot4life Apr 19 '16 at 14:11
  • 1
    @boot4life Rare? This is extremely common, there's probably hundreds of such crap beginner FAQ posted every day. Instead of finding some obscure, similar-sounding question, use the canonical duplicate, which will have good and correct answers. And closing questions with canonical duplicates is how you build up the "frequent" tab of each tag to something useful, where questions often used to close other questions as duplicates gain rank. Crude as that might be, that's the SO FAQ system per current design. – Lundin Apr 19 '16 at 14:15
  • 2
    "It is then perfectly fine to close it as a duplicate to the canonical FAQ" - that is not the consensus. You may have missed the past few discussions on this, but you can't state it like that. – CodeCaster Apr 19 '16 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .