{"record":{"id":"580af961999388f8","repo":"Zie619/n8n-workflows","slug":"str-e-580af9","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/enhanced_api.py","lineNumber":206,"sourceCode":"                return {\n                    \"trending\": trending,\n                    \"limit\": limit,\n                    \"timestamp\": datetime.now().isoformat(),\n                }\n\n            except Exception as e:\n                raise HTTPException(status_code=500, detail=str(e))\n\n        # Analytics endpoints\n        @self.app.get(\"/api/v2/analytics/overview\")\n        async def get_analytics_overview():\n            \"\"\"Get analytics overview\"\"\"\n            try:\n                overview = self._get_analytics_overview()\n                return overview\n\n            except Exception as e:\n                raise HTTPException(status_code=500, detail=str(e))\n\n        @self.app.post(\"/api/v2/analytics/custom\")\n        async def get_custom_analytics(request: AnalyticsRequest):\n            \"\"\"Get custom analytics data\"\"\"\n            try:\n                analytics = self._get_custom_analytics(request)\n                return analytics\n\n            except Exception as e:\n                raise HTTPException(status_code=500, detail=str(e))\n\n        # Performance monitoring\n        @self.app.get(\"/api/v2/health\")\n        async def health_check():\n            \"\"\"Health check with performance metrics\"\"\"\n            try:\n                health_data = self._get_health_status()\n                return health_data","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/src/enhanced_api.py#L188-L224","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the raw error in the detail field to identify the failing table/column or math operation.","Run the enhanced DB setup/migration so stats tables exist, then retry.","Index at least one workflow so overview math has a non-zero denominator.","Verify the db_path passed to the EnhancedAPI constructor is the intended database."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    overview = client.get(\"/api/v2/analytics/overview\").json()\nexcept HTTPError as e:\n    if e.response.status_code == 500:\n        overview = {\"status\": \"unavailable\"}  # dashboards degrade gracefully\n    else:\n        raise","preventionTips":["Run enhanced-API DB migrations in the deploy pipeline.","Add analytics endpoints to post-deploy smoke tests.","Never gate core functionality on analytics availability."],"tags":["http-500","analytics","sqlite","fastapi","migration"],"backgroundTag":null,"analyzedSha":"94007c1445d9258a7da116646b79473e7c7c3282","analyzedAt":"2026-08-15T04:10:37.591Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}