Where should a beginner look first when a program refuses to run?

Updated October 2026 · How we answer

Short answerStart with the exact error message and the line it points to, then check the most recent change you made. That narrows the problem faster than rereading the whole file.

Read the message before the code

A message usually names the kind of problem and a file or line number. Copy it exactly and keep it handy. The wording tells you whether you are dealing with a syntax issue, a missing name, or a type mismatch, which changes where you should look next.

Next, think about what changed since the program last worked. A new variable, an edited import, or a different file path are typical culprits. Undoing one change at a time often reveals the cause quickly.

  • Copy the full error message
  • Note the file name and line number
  • Compare with the last working version
  • Undo one change at a time

Use small test pieces

If the cause is still unclear, comment out part of the program and run what remains. Add code back in small pieces until the error returns. This shows the exact line that triggers the problem, even when the message is vague.

Keep a short log of the errors you fix and what caused them. Patterns show up quickly, such as the same missing bracket or a misspelled variable, and that record speeds up future debugging. Asking for help works too, but include the full message and the code around it.

Common mistakes

  • Rewriting large sections of code before reading the error.
  • Searching the message without including the language name.
From our shopsCASEONYX: Dark-luxe tough phone cases.