Zie619/n8n-workflows · error · HTTPException

str(e)

Error message

str(e)

What it means

A generic 500 from GET /api/v2/analytics/overview in the enhanced API. The handler delegates to self._get_analytics_overview(); any exception (DB access, aggregation over missing columns, empty-data math) surfaces as detail=str(e).

Source

Thrown at src/enhanced_api.py:206

                return {
                    "trending": trending,
                    "limit": limit,
                    "timestamp": datetime.now().isoformat(),
                }

            except Exception as e:
                raise HTTPException(status_code=500, detail=str(e))

        # Analytics endpoints
        @self.app.get("/api/v2/analytics/overview")
        async def get_analytics_overview():
            """Get analytics overview"""
            try:
                overview = self._get_analytics_overview()
                return overview

            except Exception as e:
                raise HTTPException(status_code=500, detail=str(e))

        @self.app.post("/api/v2/analytics/custom")
        async def get_custom_analytics(request: AnalyticsRequest):
            """Get custom analytics data"""
            try:
                analytics = self._get_custom_analytics(request)
                return analytics

            except Exception as e:
                raise HTTPException(status_code=500, detail=str(e))

        # Performance monitoring
        @self.app.get("/api/v2/health")
        async def health_check():
            """Health check with performance metrics"""
            try:
                health_data = self._get_health_status()
                return health_data

View on GitHub (pinned to 94007c1445)

Solutions

  1. Inspect the raw error in the detail field to identify the failing table/column or math operation.
  2. Run the enhanced DB setup/migration so stats tables exist, then retry.
  3. Index at least one workflow so overview math has a non-zero denominator.
  4. Verify the db_path passed to the EnhancedAPI constructor is the intended database.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    overview = client.get("/api/v2/analytics/overview").json()
except HTTPError as e:
    if e.response.status_code == 500:
        overview = {"status": "unavailable"}  # dashboards degrade gracefully
    else:
        raise

Prevention

When it happens

Trigger: Calling /api/v2/analytics/overview when the enhanced DB lacks stats tables, when aggregation SQL references renamed columns, or when overview computation divides by zero on an empty workflow set.

Common situations: Enhanced API pointed at a base DB created before stats tables existed; deployment where the DB bootstrap only ran for the core API; empty repository with zero workflows indexed.

Related errors


AI-assisted analysis of Zie619/n8n-workflows@94007c1445 (2026-08-15). Data as JSON: /api/errors/580af961999388f8. Report an issue: GitHub.