Based on the feedback I've seen in the comments, here is my attempt at refining the accepted answer to make it suitable for a help center article.
Note that I've deliberately used a non-programming example because I was unable to come up with a language-agnostic example that is easily understood.
What is an XY problem and how do I avoid it?
A question is about an XY problem if it is about an attempted solution X, and the actual problem Y is unclear.
For example:
Question: How do I scrape all the burned food off my pan?
Response: How much burned food is there? How old is your pan? Is it a nonstick pan? How much cooking oil are you using?...
After a bit of back-and-forth, it might turn out that OP is using a really old nonstick pan, and the coating is worn. The ideal question which would have solved OP's problem is:
Is it time to throw away my ten-year-old nonstick pan?
In the meantime, someone could have posted an answer which explains how to scrape the food off in great detail, but this turns out unnecessary if OP should just throw away their pan.
The issue with XY problems
XY problems are often impossible to answer without follow-up questions from commenters.
This can take a lot of time, and may be frustrating.
It can also result in answers which are overly broad, or answers which turn out irrelevant once the underlying problem is clear.
How to avoid XY problems
It's not always easy to avoid an XY problem. If you don't know that non-stick coating doesn't last forever, the ideal question isn't obvious.
However, you can ask about the general problem you're trying to solve, such as:
Is it normal that so much food gets stuck to my nonstick pan?
Also, provide all relevant details.
For programming questions, this typically includes:
Even if you ask about an XY problem, other users can recognize the underlying problem if you give them enough information from the start.