...

/

Debugging and Iterative Improvement

Debugging and Iterative Improvement

Learn how to use Gemini CLI to diagnose errors, apply fixes, and make iterative improvements to an application.

In the last lesson, we used the Gemini CLI to generate and run our Flask app. We noticed that the server starts, but the app crashes when we try to open it in the browser. This is a common scenario and a good chance to see how Gemini can help debug. In this lesson, we’ll fix the critical error blocking the app, and once it’s running, we’ll look at logical flaws and use Gemini to make iterative improvements.

Press + to interact

Debugging the application

In our last step, the Gemini CLI confirmed that it had successfully installed the dependencies and launched our Flask server, providing a URL to view the application. However, when we navigate to that address in a browser, our bug tracker doesn’t appear. This is a classic development scenario: the terminal indicates success, but the result isn’t working as expected. Let’s use this as our first debugging challenge.

Identifying the error

When we attempt to access the application at the provided URL (e.g., http://127.0.0.1:5000), we are met with a generic browser error message:

Press + to interact
Application connection error
Application connection error

This error tells us that the browser was unable to establish a connection. The cause could be anything from a misconfigured server to an application that is crashing immediately upon startup. Our task is to provide this symptom to our AI agent and ask it to ...