We currently close questions as off-topic when those questions are asking, essentially, for the community to debug the asker's project. When this close reason is applicable is a little unclear at the moment, so I am putting this post out there to solicit feedback and clarification on the exact circumstances under which a question should be classified as a "debug my code" question. I would like to arrive at a consensus on the wording for

  • why a question is considered a "debug my code" question and
  • what a the user should do to improve the question.

The primary motivation for this is to reduce confusion among users, especially new ones (and especially given that sometimes a question is so closed because it provides too much and sometimes it is so closed because it provides too little code). My secondary motivation is to establish verbiage to use in an upcoming proposal to make "debug my code" a standard close reason for the site (rather than one that must be manually entered via the "other" off-topic radio button).


4 Answers 4


The key word in "debug my code" is my.

If the code being asked about is short, generic, and something which a lot of people are likely to have written in that form, then it's not a "debug my code" question.

Similarly, if the code you're asking about was written by someone else and is available to lots of people who might also have problems with it (for example, if it's inside an open source library), then it's similarly not a "debug my code" question.

But if you're posting whole functions from your own code and are asking people to find the bug you put in your own implementation, that's asking other people to debug your code for you, which is against the site's current rules.

  • 2
    \$\begingroup\$ I think it's worth explicitly calling out tutorial code. Technically it's "someone else's" and "widely available". But recently there's been a glut of people copy-pasting code from mediocre tutorials, not understanding it, failing to get it to work, and then dumping it here and asking "fix it". \$\endgroup\$ Commented May 8, 2014 at 8:29

I think a question can be considered a "debug my code" question when it describes a problem without also describing an appropriately-localized context in which the problem could occur (along with proof that the problem does occur there).

Specifically, if a question provides so much (or so little) code that an answerer would need to either

  • post an answer based on speculation or
  • engage in a follow-up dialog back and forth in the comments

then the question can be categorized as a "debug my code" question. Note that this specifically does not address the length of the code posted, because I believe that to be a red herring (per the fact that a user could be asking for debugging help with either a lot of code or a little bit of code); what's more important is how well the presented completely scopes the defined problem.

This is different from (although potentially a subset of) the "too broad" close reason, although the definition for "too broad" does not address the scoping issue of the code per se, which I why I believe it is still relevant to use a distinct close reason.

I would suggest we use wording like the following:

"This question appears to be off-topic because it is asking for others to debug your project for you. Use the debugging tools available to you to isolate your issue to the specific part of your code that demonstrate it. See this question for more information."

  • \$\begingroup\$ May i ask why the need to close of question about debugging help? Is it because it seems lazy? Because the answer is only relevant to that specific code? Or maybe because the answer will not provide help for others that find the question later looking for answers? \$\endgroup\$
    – Daarwin
    Commented Feb 11, 2014 at 8:03
  • \$\begingroup\$ I imagine for a number of reasons, but a big reason is that it is too localized to fit the Q/A->Archive format that this site runs. Localized debug questions like that are unlikely to generate more widely useful answers for future reference, as they are tied to a very specific and unique situation. Coupled with that, the higher numbers of these questions would cause too much clutter, and make it more difficult to find the valuable answers. \$\endgroup\$
    – Evan
    Commented Feb 11, 2014 at 15:10
  • 2
    \$\begingroup\$ This question is not about whether or not these sorts of questions should be closed; that is the standing policy (see here and here). If you would like to debate that policy please start another meta thread. \$\endgroup\$
    – user1430
    Commented Feb 11, 2014 at 15:54
  • \$\begingroup\$ So just reading this thread now, probably be a good idea to make this kind of stuff a bit more clear on the main website, so people don't waste their time asking \$\endgroup\$
    – dbomb101
    Commented Jun 19, 2014 at 15:55
  • \$\begingroup\$ We can't do that, unfortunately (we don't have control over "the main website" beyond a few select areas, such as the close reasons). We could request to have the FAQ modified, but I don't really think it's worth it given the number of people who still ask questions the FAQ says not to, because they don't bother reading it). \$\endgroup\$
    – user1430
    Commented Jun 19, 2014 at 15:59

When all of these apply ...

  1. When a code sample is given and the Asker is expecting the code to be "fixed".
  2. When the solution to fixing the code is not useful to many others.
  3. When the context of the code is "specialised" or specific to some particular context / scenario that others may not typically be met with programming.

Questions that meet some of these criteria may be considered "debug my code" but also may be relevant / interesting to others doing similar projects.

Questions that where none of the above apply likely are of a different context, for example ...

Given this code sample ... (insert any code snippet here)

"How does it calculate X correctly?" , the asker be trying to understand some code from something they read online.

Then theres ... "How do i calculate x from this ...", Probably homework.

Then you have ... "X isn't correct, i was expecting a value of 42, could you tell me why?", This person maybe asking how to fix the given code, I think this may fall under the remit of "debug my code" given that when a solution is provided it is only beneficial to the asker.


I could've sworn there was a selection for "too localized" in the close options; maybe that was removed at some point, because I don't see it now.

Anyway I see "debug my code" questions as a specific variant of "too localized" questions: debugging your code helps you but not anybody else. Stated differently, if answering your question amounts to hunting down errors in your specific code snippet and that answer wouldn't help anybody else, then it's a "debug my code" question.

  • 2
    \$\begingroup\$ "Too localized" was removed as part of the close reason/on-hold refactor to the SE software, I believe. And you're right, we used to that one almost exclusively to close the kinds of questions I'm referring to. \$\endgroup\$
    – user1430
    Commented Feb 13, 2014 at 16:58
  • 1
    \$\begingroup\$ I tried. :) meta.gamedev.stackexchange.com/a/1181/19126 \$\endgroup\$ Commented Apr 5, 2014 at 3:01

You must log in to answer this question.