33

I came across the following question: Is it possible to import dcm files into Next.js?.

It says the following in the body:

is there anyway i can solve this issue? i tried to ask chat-gpt and it didn't help as much

that's what chat-gpt's solution

module.exports = {
  webpack: (config) => {
    config.module.rules.push({
      test: /\.dcm$/i,
      use: 'raw-loader',
    });
    return config;
  },
};

We have multiple posts here on meta discussing how to handle "answers" that use ChatGPT.

But, how can I handle the questions which provide an MCVE or "what I tried" generated by ChatGPT?

1

4 Answers 4

48

Saying "I got this code from ChatGPT and it doesn't work"

This is not a rule violation. The generated content is not being presented as the user's own, and it's not being presented as an attempt to answer the question. Instead, it's just an elaboration upon "the site said I should explain what I've tried already, and I've tried asking ChatGPT". The code itself is generally noise in these cases.

(Saying "I tried asking ChatGPT" is generally also noise in these cases. It doesn't help people understand what the question is. Keep reading for more on that.)

MCVEs are for "what is wrong" questions, not "how to" questions

If someone is asking how to do something, an existing code attempt to do that thing is not relevant - unless the question has been poorly asked, and really is a question about how to fix that code.

Most of the time, people who ask "how do I do X?" really do want to know "how do I do X?", and their non-working attempt at doing X is a distraction. It assumes a general technique Y, which might not be appropriate. Either the question should be closed as unclear, or the code should be removed. The provenance of the code is irrelevant to that.

The "What have you tried?" question

The reason we ask "what have you tried?" is not to gatekeep people who are "unworthy" of getting an answer because they are too "lazy". Instead, it is to help identify the actual question.

If the question as stated is "how do I do X?", saying "I tried Y" is not actually a good thing to include in the question. Instead, the person asking should reflect upon the result of trying Y, to refine the question:

  • Is this really a question about how to do X using Y - i.e., about how to make Y work, or about the Z problem that occurred when trying Y?

  • Is it really a question about specifically how to do X without using Y?

  • If X is complex, does Y represent an attempt to analyze and decompose X? If so - where did it go wrong? Now the question is actually about that step in the process.

However, if Y is ChatGPT-generated code, then it almost certainly does not help refine anything. People who are asking ChatGPT to write code are not analyzing the problem. They cannot reasonably be expected to do any reflection on the code - if they could understand it as-is, they could have written it themselves. Such code should, again, be edited out to leave a plain "how do I do X?" question, because when Y is not understood by the asker, "how do I do X with Y?" is incoherent. (Explaining Y - see the next section - is a separate question, if it's valid at all.)

But what if ChatGPT tried to explain?

If the question is about an explanation that ChatGPT offered for the code it generated, that's a whole other kettle of fish. Such questions are almost always closable as unclear.

  • If the code is buggy, then there is nothing to explain. Garbage in, garbage out (to/from the "explain code" algorithm).

  • If the explanation is incoherent, then there is no good way to make sense of it. Perhaps it can be edited out, but then this just leaves an "explain this code dump to me" question.

  • If ChatGPT managed to generate working code and a coherent explanation, and OP just doesn't understand the explanation - what is the remaining question? There needs to be a concrete way for us to understand why OP does not understand the existing explanation, in order to be able to write an answer. And then it still needs to be something that could potentially be of use to others. In which case, there is probably a better way to create the example.

6
  • 17
    Sometimes an MCVE is relevant for how-to questions, if only to establish the context or constraints needed for an answer. Commented Jun 12, 2023 at 11:24
  • 4
    @MarkRotteveel I tried to touch on that in my examples of "reflecting on the result of trying Y". Feel free to edit if you think something's missing and can be added smoothly. Commented Jun 12, 2023 at 11:56
  • 1
    "- what is the remaining question? " Plenty. Try explaining it another way you might have an answer. ChatGPT can't educate very well either. I've answered human questions a different way to other answers and gotten upvotes and the occasional accepted answer.
    – Joshua
    Commented Jun 13, 2023 at 2:59
  • 5
    @Joshua No. If the OP fails to describe what they do not understand, there are too many possible alternative explanations, and the question is too broad to be answered. Are they getting hung up on some detail? Or are they lacking the basics?
    – Bergi
    Commented Jun 13, 2023 at 3:54
  • 2
    ` if they could understand it as-is, they could have written it themselves` - often true, but not always - ChatGPT can be very helpful in pointing you to the right methods in an obscurely-documented API, for example. So instead of asking the question "How do I do x in API y?" on Stackoverflow, I can ask it on ChatGPT instead, and take the pointer in the right direction from there. Not disagreeing with your points wrt how to ask questions here, just wanted to add that comment. Commented Jun 13, 2023 at 7:37
  • Despite your explanation later, the paragraph on MCVE doesn't quite give off the right impression IMO. For almost all cases, code describes itself far better than just words. Even if the code is wrong, how it's going wrong is often clue enough to infer what needs to be answered.
    – Passer By
    Commented Jun 13, 2023 at 7:37
18

In this specific example, I would probably suggest that the extract is "noise". The OP basically says "I asked ChatGPT; it didn't work. <Code Dump>". There's no details of why the "solution" provided by ChatGPT didn't work/wasn't helpful, nor does the OP explain what they didn't understand about the answer they got from ChatGPT. As such, it adds nothing helpful/useful to the question (other than to be a signpost for "ChatGPT generated content isn't to be trusted").

This isn't to say that it should always be removed. If the content, from ChatGPT, is well introduced and the user explains why the solution doesn't fit their needs or what they don't understand about it, then I don't see an issue.

Something like the following would likely be "fine":

Main Question Body

I asked ChatGPT about the problem as well. It explained that I could use foo to link the bar, and then sandwich the cheese. The code it provided, below, did get me some of the way there, but it didn't actually sandwich the cheese the way I describe; it didn't have any added sauce. I'm also not sure how bar is related to foo in its solution.

<Code Block generated by ChatGPT>

As for after the content is removed/left, judge the question on its own merits. If the question can't be answered due to a lack of an MRE, then vote to close it as such; the ChatGPT content is unlikely to actually contribute to if the question includes one or not.

5
  • 4
    I believe the same will be true to "Somebody on the Internet proposed this code, but it doesn't work". If it's related to question and has reason to be a part of a question - left it. Maybe answer to why suggested didn't work will help to understand underlying issue of correct solution. If it's simple noise to inflate the question - edit it out.
    – markalex
    Commented Jun 12, 2023 at 10:46
  • 1
    I suppose I have a little more trust for content written by human beings, @markalex , but much of the above can be applied. "I tried the solution in this answer, [link], but it didn't work." are also rarely likely to be of benefit when the OP doesn't demonstrate their attempt to use that solution; I long ago lost count of posts where users add syntax errors to existing answers or change them incorrectly (due to not taking time to read and understand them) and saying they "don't work". I just tend to get the hammer out and only remove the nail after they properly evidence it's not a dupe.
    – Thom A
    Commented Jun 12, 2023 at 10:53
  • 1
    The correct action would be to use the edit feature, @chivracq . We can't all write "perfect English"; help improve the site rather than move (potentially) good content down because of a single geammaratical error...
    – Thom A
    Commented Jun 13, 2023 at 6:52
  • Then provide a constructive comment, @chivracq . Your comment is borderline rude and condescending. It's not constructive, it just belittles the user who you have no idea about why they may have made such an error; they might not have English as their first language, they may have literacy issues, or their autocorrect might have been overzealous. If you want the post to be improved, that type of comment is unlikely to convince the user to correct a (single) error to ensure that your perfect world is met.
    – Thom A
    Commented Jun 13, 2023 at 12:27
  • It was never about the downvote, @chivracq , it was about the "I stopped reading because you used an apostrophe after 'there', so your post is bad." attitude and that you had to comment that in a non-constructive way.
    – Thom A
    Commented Jun 13, 2023 at 12:37
9

Imagine a question like this:

Hi I am trying to do such-and-such. I have tried googling and found

<insert-code-block-here>

from some-tumblr-post. I tried it and didn't work. What is the solution?

To me, this question is not much different. Instead of a Tumblr post, he found it through his tool of choice, which happened to be ChatGPT. If you think this is an example of the post not showing research effort, treat it as such. If the ChatGPT answer is almost correct and just off by a small thing, and you know how to fix and also want to help, treat it as such.

There isn't any reason to treat this question any different than hundreds of other questions that are posted daily, just because the user admitted to having tried ChatGPT (or any other tool for that matter).

2
  • I like this approach. Basically treat "from ChatGPT" as "from anywhere on the net". Then most of it has already been treated here on meta. Commented Jun 14, 2023 at 14:15
  • 1
    @NoDataDumpNoContribution I believe thats how it should be. Some users here are making a big deal out of chatgpt just to make noise and push their agenda, and think they represent the hundreds of thousands of rest of us users.
    – user13267
    Commented Jun 14, 2023 at 23:04
5

If the person asking the question quite obviously don't understand what they are asking, then close as "needs details or clarity". If they don't understand it, it's not our responsibility to, nor is it our responsibility to help them understand it.

You must log in to answer this question.

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