-
Notifications
You must be signed in to change notification settings - Fork 4
Troubleshooting
Flamehaven edited this page Nov 14, 2025
·
1 revision
This guide expands on the quick tips in README.md. Work through the checklist
from top to bottom whenever something behaves unexpectedly.
| Symptom | Root Cause | Resolution |
|---|---|---|
ModuleNotFoundError: flamehaven_filesearch |
Old pip resolver or partially installed extras |
python -m pip install -U pip then pip install -e ".[dev,api]"
|
ImportError: No module named 'google' |
google-genai extra missing |
pip install flamehaven-filesearch[google] or set allow_offline=True
|
poetry / pipx virtualenv conflicts |
PATH still points to global interpreter | Activate the venv explicitly (source .venv/bin/activate or .\.venv\Scripts\Activate) |
python -m pip check # dependency integrity
python -m flamehaven_filesearch.cli --help
python - <<'PY'
from flamehaven_filesearch import FlamehavenFileSearch
print("Version:", FlamehavenFileSearch().config.default_model)
PY- Run
python - <<'PY'snippet below to ensure whitespace was trimmed.import os key = os.getenv("GEMINI_API_KEY") print("Key length:", len(key or "")) print("Contains space:", " " in (key or ""))
- Keys copied from emails often include smart quotes—paste them into a plain text editor first.
- For CI, use repository secrets and pass them as
envin workflows instead of committing.env.
| Symptom | Fix |
|---|---|
RuntimeError: Event loop is closed on Windows |
Use python -m uvicorn flamehaven_filesearch.api:app --reload --loop asyncio
|
Address already in use |
Another process occupies :8000. Kill it or set PORT=8080. |
Logs show Service not initialized
|
Startup hook failed. Run ENVIRONMENT=development flamehaven-api to get verbose tracebacks. |
Checklist:
-
pip checkpasses. -
GEMINI_API_KEYexported. -
DATA_DIRwritable (default: cwd). -
uvicornreachable (which uvicorn).
The validators reject filenames containing path separators, reserved names, or
leading dots. The response body includes detail explaining the decision. If
you genuinely need to import such files, rename them before upload.
| Option | Description |
|---|---|
| Increase limit |
export MAX_FILE_SIZE_MB=200 before starting the API |
| Split PDFs | Use pypdf or gs to split into chapters |
| Batch CLI | Call FlamehavenFileSearch.upload_files([...]) so errors are grouped |
-
Cache Miss vs Hit – Check logs for
Cache MISSmessages. First queries will be slower (~2-3 s). Repeated queries should drop below 10 ms. -
Temperature – For more deterministic answers set
searcher.search(..., temperature=0.1). -
Max Sources – Reduce
config.max_sourcesto avoid noisy citations. - Prompt Hygiene – Avoid overly long queries; the validator clamps to 1 000 characters. Shorter, direct questions produce better answers.
Default limits: 10/minute for uploads, 100/minute for searches/metrics.
- To override, set environment variable
UPLOAD_RATE_LIMIT=30/minute(and similar for other endpoints) before launching the API. - During pytest runs the custom
rate_limit_keyisolates suites via thePYTEST_CURRENT_TESTmarker. If you run multiple local servers concurrently, export differentRATE_LIMIT_PREFIXvalues.
| Use Case | Command |
|---|---|
| Structured logs |
ENVIRONMENT=production flamehaven-api (default) |
| Human-readable logs | ENVIRONMENT=development flamehaven-api |
| Trace request IDs | curl -H "X-Request-ID: debug-123" ... |
| Export Prometheus snapshot | curl http://localhost:8000/prometheus > metrics.prom |
If logs are missing, ensure your container runtime pipes STDOUT/STDERR to the
host (e.g., docker logs).
| Issue | Resolution |
|---|---|
ModuleNotFoundError in container |
Rebuild after pyproject.toml edits: docker build --no-cache ...
|
| Volume permissions | Run docker run -u $(id -u):$(id -g) or adjust DATA_DIR owner |
| Health endpoint unreachable | Ensure reverse proxy forwards /health without authentication |
- GitHub Discussions for “How do I…” questions.
-
GitHub Issues for reproducible bugs (include logs &
curl /healthoutput). -
Security vulnerabilities: email
security@flamehaven.space.
When filing issues, attach:
Environment: macOS 14.6, Python 3.11.9, flamehaven-filesearch 1.1.0
Command: curl ...
Expected: ...
Actual: ...
Logs: (attach relevant snippet)
Having this information drastically shortens turnaround time.