Session 1· Reference

Troubleshooting Guide

What you'll learn
  • Identify the cause of common Session 1 errors
  • Fix environment and API problems without an instructor
  • Know when to escalate and how to ask a good question

Every error below is one students actually hit during Session 1. Click any row to expand the cause and the exact fix. Come back to this page whenever a script misbehaves.

Environment & setup errors

API errors from OpenAI

Argument and file errors

Behavioural surprises (not errors)

"My output is different every run"
That is normal. Models are non-deterministic. Set temperature=0 if you need the same answer twice (H2 shows how).
"The model does not remember what I said"
Also normal — the API is stateless. This is the whole point of H4 and H5. Review those if you missed the "aha".
"finish_reason is length"
Your output was cut off at max_output_tokens. Raise the cap or ask for a shorter answer.
"The model sometimes refuses or gives safety warnings"
Each provider has a safety layer. Try rephrasing the prompt. Educational/analytical framings usually pass where "how do I…" framings get refused.

When nothing above helps

  1. Re-read the exact error message in your terminal — Python usually tells you the file and line number.
  2. Run the script with --help to see what arguments it expects.
  3. Open the solution toggle on the exercise page and diff it against your file.
  4. Run python -V inside your terminal to confirm you are using .venv's Python, not system Python.
  5. Paste the full error message into your preferred search engine — 99% of errors are googleable.
Still stuck?
Ask your instructor or classmates. Include: the exact command you ran, the full error message, and the OS you are on. Those three things unblock 90% of issues.