Repository navigation
Description
Fail to Launch frontend and backend server.
command used to initialise:
git clone https://github.com/AISecurityConsortium/AIGoat.git
cd AIGoat
./scripts/start.sh
Output:
Cloning into 'AIGoat'...
remote: Enumerating objects: 699, done.
remote: Counting objects: 100% (134/134), done.
remote: Compressing objects: 100% (99/99), done.
remote: Total 699 (delta 51), reused 82 (delta 33), pack-reused 565 (from 2)
Receiving objects: 100% (699/699), 47.88 MiB | 3.68 MiB/s, done.
Resolving deltas: 100% (209/209), done.==========================================
AI Goat -- Starting Application[INFO] Checking Ollama...
[INFO] Starting Ollama in the background...
[OK] Ollama is running
[INFO] Pulling model 'mistral' (this may take a few minutes on first run)...
pulling manifest
pulling f5074b1221da: 100% ▕████████████████████████████████████████████████████████▏ 4.4 GB
pulling 43070e2d4e53: 100% ▕████████████████████████████████████████████████████████▏ 11 KB
pulling 1ff5b64b61b9: 100% ▕████████████████████████████████████████████████████████▏ 799 B
pulling ed11eda7790d: 100% ▕████████████████████████████████████████████████████████▏ 30 B
pulling 1064e17101bd: 100% ▕████████████████████████████████████████████████████████▏ 487 B
verifying sha256 digest
writing manifest
success
[OK] Model 'mistral' pulled successfully
[INFO] Checking Python dependencies...
[OK] Python dependencies ready
[INFO] Initializing database...
Tried running, http://localhost:3000/ and http://localhost:8000/docs in browser.
Output:
Firefox can’t connect to the server at localhost:3000
Firefox can’t connect to the server at localhost:8000
Tried running commands to see if port 3000 and 8000 is occupied somewhere
lsof -i :3000
lsof -i :8000
the output was blank
Tried Stopping / Resetting with command:
./scripts/stop.sh
./scripts/start.sh --fresh
Output:
==========================================
AI Goat -- Stopping Application[INFO] No PID file for frontend
[INFO] No PID file for backend
[INFO] Stopping ollama (PID: 10219)...
[OK] ollama stopped[OK] AI Goat stopped.
[INFO] Fresh start requested -- removing existing database and vector store
[OK] Cleared database and ChromaDB==========================================
AI Goat -- Starting Application[INFO] Checking Ollama...
[INFO] Starting Ollama in the background...
[OK] Ollama is running
[OK] Model 'mistral' is available
[INFO] Checking Python dependencies...
[OK] Python dependencies ready
[INFO] Initializing database...
Current Configuration:
- System: MacOS 26.4.1, M5 Pro
- Python 3.11.15
- Node.js v25.9.0
- Ollama 0.20.7
- Firefox 149.0.2 (aarch64)
Activity
thesk7828 commentedon Apr 15, 2026
The problem occurred because of a compatibility issue with your Python version. The scripts/start.sh initializes the database as part of its startup sequence. When this initialization step ran, an error silently forced the script to terminate, which meant your backend and frontend never had the chance to start!
Root Cause:
The codebase natively uses the Python 3.10 syntax for type hinting (e.g., str | None). However, the script is running with Python 3.9. While Python 3.9 can sometimes skip over | annotations, libraries like SQLAlchemy and Pydantic explicitly evaluate these types at runtime.
Evaluating str | None using eval() in Python 3.9 natively throws a TypeError, causing the backend initialization code and subsequent data-seeding steps to fail completely. Since start.sh explicitly suppresses Standard Error outputs for these steps using 2>/dev/null, it masked the underlying bug.
thesk7828 commentedon Apr 15, 2026
I have a PR ready to fix this issue, fix is as follows:
Checklist
Merge pull request #1 from thesk7828/fix/python-39-type-hints
iamfarooqh commentedon Apr 23, 2026
Dear @thesk7828 ,
Thanks for trying to run AI Goat locally in your machine and opening the issue. Appreciate the investigation and the fix! The Python 3.9 type hint fix looks technically sound. Please also note whether you were running Python 3.9 or 3.11 when you hit this issue, as we'd like to confirm this fully resolves the startup failure.
Also please run the below diagnostic command and share the output:
source venv/bin/activate python3 -c " import asyncio from app.core.database import init_db asyncio.run(init_db()) "thesk7828 commentedon Apr 23, 2026
Sure @iamfarooqh, Here's the screenshot! Btw, I was using 3.11 by the time!
iamfarooqh commentedon Apr 23, 2026
@thesk7828 - Thanks for the screenshot! Can you also run the same command while on the original main branch (without your fix applied) so we can confirm that main specifically fails due to the type hint issue on Python 3.11? This will help us confirm whether your fix is addressing the root cause. The command to run on main:
thesk7828 commentedon Apr 23, 2026
here's the result @iamfarooqh
thesk7828 commentedon Apr 23, 2026
@iamfarooqh - Also, attaching my branch too for better visibility!
iamfarooqh commentedon Apr 24, 2026
@thesk7828 Thank you so much for sharing all the required information.
The screenshots confirm your fix is exactly right. Could you please open a PR against AISecurityConsortium/AIGoat:main from your fix/python-39-type-hints branch? We're ready to review and merge.
Please follow these steps to open a PR against the main repo:
base repository: AISecurityConsortium/AIGoat
base branch: main
head repository: thesk7828/AIGoat
compare branch: fix/python-39-type-hints
A short summary of what the fix does
The Python version affected (3.9)
A reference to the issue: type Closes Fail to launch the server #6 in the description so the issue auto-closes when merged
We'll review and merge it from there. Thanks for the contribution!
iamfarooqh commentedon Apr 24, 2026
Thanks @thesk7828 for the thorough investigation and the fix!
Note: this fix is required for Python 3.9 users. If you are on Python 3.10 or higher and still hit startup issues, please check logs/backend.log for errors.