chapter fifteen

15 Common Errors and Troubleshooting

 

This chapter covers

  • The six most common errors when working with Ollama and Streamlit, along with their solutions
  • A three-step method for reading any Python traceback
  • Defensive coding with try/except blocks, print debugging, and logging
  • A systematic troubleshooting checklist and flowchart
  • How to ask for help effectively when you are stuck

Every programmer encounters errors. The difference between a beginner who gives up and a developer who ships software is not the number of errors they see -- it is how quickly they can diagnose and fix them. Error messages are not failures; they are precise diagnostic information from the computer telling you exactly what went wrong. This chapter builds your diagnostic toolkit: reading error messages, isolating failures, and applying systematic fixes. These are skills that transfer to any programming language or framework.

15.1 Common Errors and Solutions

This section catalogs the six errors you are most likely to encounter. Think of it as a field guide -- the bigger your mental catalog of errors, the faster you fix them.

15.1.1 Error 1: Model Not Found

This is the single most common error for Ollama beginners. You try to run a model, and Ollama tells you it does not exist.

ollama run llama3.2:3b
Error: model "llama3.2:3b" not found, try pulling it first

The message is clear: the model file is not on your machine. You either never downloaded it, or you typed the name wrong.

Solution

Pull (download) the model first:

15.1.2 Error 2: Connection Refused

15.1.3 Error 3: Out of Memory

15.1.4 Error 4: Port Already in Use

15.1.5 Error 5: Streamlit ModuleNotFoundError

15.1.6 Error 6: Python Version Issues

15.2 Reading Error Messages Effectively

15.2.1 The Three-Step Method

15.2.2 Common Error Types and What They Mean

15.3 Debugging Techniques

15.3.1 Technique 0: Ask an LLM to Help Read the Error

15.3.2 Technique 1: Try/Except Blocks

15.3.3 Technique 2: Step-by-Step Verification

15.3.4 Technique 3: Print Debugging

15.3.5 Technique 4: Logging

15.4 The Troubleshooting Checklist

15.4.1 The Complete Troubleshooting Checklist

15.4.2 A Note on Asking for Help

15.5 Summary

15.6 Exercises