Debugging
Also: 除錯 · debugging · traceback · 錯誤訊息怎麼看 · stack trace
Reading an error message properly, finding the line that actually failed, and changing only that.
When you will meet it
This is the highest-return skill a beginner can learn, and it does not require knowing how to program. Nine install failures in ten already print their answer: the last line says what broke, and a few lines above say which file and which line. Without it your only moves are reinstalling, switching tools, or pasting the whole thing at an AI to guess — every one slower than reading three lines.
An analogy
Like reading a medical report instead of only knowing 'you feel unwell'. The last line is the diagnosis; the pages above are how it got there. Most people start at the top and give up halfway — and the answer is at the bottom.
Minimal example
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
main()
File "/app/main.py", line 5, in main
text = read_config("settings.ini")
File "/app/read.py", line 2, in read_config
return open(path).read()
FileNotFoundError: [Errno 2] No such file or directory: 'settings.ini'Three moves only: read the last line first (FileNotFoundError, and which file is missing); then the two or three lines above it (the failure is really at read.py line 2, not main.py); then go check whether that file exists and whether the path is written correctly. Only those three spots in the whole block matter.
What people get wrong
- Reading from the top. A Python traceback puts its conclusion on the last line and everything above is the route; Node.js stack traces behave similarly. Treating it as prose to read from the start is how you lose patience halfway.
- Reacting to an error by immediately reinstalling the tool or rebooting. The message usually already states what is missing and on which line; reinstalling only prints the same message again.
- Handing the whole error to an AI without redacting secrets first. Error output frequently prints your Authorization header or environment variables verbatim.
Related terms
Next
- Triple Strike: OMP Error #15, PEP 668, and Python Dependency Hell23 min
- 五分鐘設置你的 LLM 開發環境15 minChinese only