Zie619/n8n-workflows · error · HTTPException
Error fetching integrations: {str(e)}
Error message
Error fetching integrations: {str(e)} What it means
A generic 500 from the /api/integrations endpoint. The handler calls db.get_stats() and wraps any exception with the message 'Error fetching integrations: {str(e)}'. The endpoint itself only returns counts (the integrations list is hardcoded empty), so the real failure is always inside get_stats() — typically SQLite/database access.
Source
Thrown at api_server.py:624
try:
db.index_all_workflows(force_reindex=force)
print(f"Reindexing completed successfully (requested by {client_ip})")
except Exception as e:
print(f"Error during reindexing: {e}")
background_tasks.add_task(run_indexing)
return {"message": "Reindexing started in background", "requested_by": client_ip}
@app.get("/api/integrations")
async def get_integrations():
"""Get list of all unique integrations."""
try:
stats = db.get_stats()
# For now, return basic info. Could be enhanced to return detailed integration stats
return {"integrations": [], "count": stats["unique_integrations"]}
except Exception as e:
raise HTTPException(
status_code=500, detail=f"Error fetching integrations: {str(e)}"
)
@app.get("/api/categories")
async def get_categories():
"""Get available workflow categories for filtering."""
try:
# Try to load from the generated unique categories file
categories_file = Path("context/unique_categories.json")
if categories_file.exists():
with open(categories_file, "r", encoding="utf-8") as f:
categories = json.load(f)
return {"categories": categories}
else:
# Fallback: extract categories from search_categories.json
search_categories_file = Path("context/search_categories.json")
if search_categories_file.exists():View on GitHub (pinned to 94007c1445)
Solutions
- Run the database indexing/bootstrap step once so the DB and its stats tables exist, then retry GET /api/integrations.
- Check the server logs for the underlying exception text appended after 'Error fetching integrations:' — it names the exact SQLite error (no such table, unable to open database file, database is locked).
- Verify the server is started from the directory the DB path is relative to, or make the DB path absolute via config/env var.
- If 'database is locked', stop concurrent writers or enable WAL mode on the SQLite file.
Defensive patterns
Strategy: try-catch
Validate before calling
from pathlib import Path
def db_ready(db_path: str = "workflows.db") -> bool:
p = Path(db_path)
return p.exists() and p.stat().st_size > 0 Try / catch
try:
data = client.get("/api/integrations").json()
except (ConnectionError, TimeoutError):
raise # transport issues, not this error
except HTTPError as e:
if e.response.status_code == 500 and "Error fetching integrations" in e.response.text:
# degrade gracefully: counts are optional metadata
data = {"integrations": [], "count": 0}
else:
raise Prevention
- Run the DB bootstrap/indexing step as part of deployment before serving traffic.
- Use an absolute DB path from config so cwd changes cannot break resolution.
- Enable SQLite WAL mode to avoid locked-database 500s during concurrent reindexing.
When it happens
Trigger: GET /api/integrations when the SQLite database file does not exist, is locked by another writer, has a missing/corrupt stats table (e.g. created by an older schema version), or when db was never initialized because indexing never ran.
Common situations: Fresh clone where scripts/create_db.py (or equivalent indexing step) was never run; the server's working directory differs from the one containing the .db file so the relative path resolves nowhere; concurrent reindex writing the DB while stats are read; schema drift after upgrading the code without re-running migrations.
Related errors
- Error fetching stats: {str(e)}
- Analytics error: {str(e)}
- Error searching by category: {str(e)}
- Trend analysis error: {str(e)}
- {str(e)}
AI-assisted analysis of Zie619/n8n-workflows@94007c1445 (2026-08-15).
Data as JSON: /api/errors/c7f4c42eef22a4f4.
Report an issue: GitHub.