{"record":{"id":"4f8324cabe4a111b","repo":"Zie619/n8n-workflows","slug":"str-e","errorCode":null,"errorMessage":"{str(e)}","messagePattern":"\\{str\\(e\\)\\}","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/enhanced_api.py","lineNumber":125,"sourceCode":"                    sort_by=sort_by,\n                    sort_order=sort_order,\n                    limit=limit,\n                    offset=offset,\n                )\n\n                response_time = (time.time() - start_time) * 1000\n\n                return {\n                    \"workflows\": workflows,\n                    \"total\": len(workflows),\n                    \"limit\": limit,\n                    \"offset\": offset,\n                    \"response_time_ms\": round(response_time, 2),\n                    \"timestamp\": datetime.now().isoformat(),\n                }\n\n            except Exception as e:\n                raise HTTPException(status_code=500, detail=str(e))\n\n        @self.app.post(\"/api/v2/workflows/search\")\n        async def advanced_workflow_search(request: WorkflowSearchRequest):\n            \"\"\"Advanced workflow search with complex queries\"\"\"\n            start_time = time.time()\n\n            try:\n                results = self._advanced_search(request)\n                response_time = (time.time() - start_time) * 1000\n\n                return {\n                    \"results\": results,\n                    \"total\": len(results),\n                    \"query\": request.dict(),\n                    \"response_time_ms\": round(response_time, 2),\n                    \"timestamp\": datetime.now().isoformat(),\n                }\n","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/src/enhanced_api.py#L107-L143","documentation":"A generic 500 from GET /api/v2/workflows (enhanced search listing) in enhanced_api.py. The handler times the query and returns a workflow list; any exception in _search_workflows_enhanced or DB connection setup is re-raised with detail=str(e), exposing the raw underlying error.","triggerScenarios":"Calling /api/v2/workflows with filters when the SQLite DB file is absent, a filter references an unknown column, or the dynamic query builder composes invalid SQL from unexpected query parameters (e.g. sort=invalid_field).","commonSituations":"DB never created on fresh setup; filter/sort parameter names drifted from the schema after an update; relative db_path resolved from the wrong cwd; DB locked by concurrent writes.","solutions":["Read the detail field — it contains the literal SQLite/Python error (e.g. 'no such column: w.foo').","Create/point to the correct database: run the bootstrap script or fix the db_path used by EnhancedAPI.","Remove or correct unsupported filter/sort parameters and retry with a bare call.","If 'database is locked', reduce concurrent writers or enable WAL journaling."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from pathlib import Path\n\ndef enhanced_db_ready(db_path: str) -> bool:\n    return Path(db_path).exists() and Path(db_path).stat().st_size > 0","typeGuard":null,"tryCatchPattern":"try:\n    data = client.get(\"/api/v2/workflows\", params=filters).json()\nexcept HTTPError as e:\n    if e.response.status_code == 500:\n        # strip filters to isolate the offending parameter, then retry once bare\n        data = client.get(\"/api/v2/workflows\").json()\n    else:\n        raise","preventionTips":["Keep filter/sort parameter names pinned to the server's documented schema.","Bootstrap the DB in deployment before exposing v2 endpoints.","Log the returned str(e) detail — it names the exact SQLite failure."],"tags":["http-500","sqlite","search","fastapi","query-building"],"backgroundTag":null,"analyzedSha":"94007c1445d9258a7da116646b79473e7c7c3282","analyzedAt":"2026-08-15T04:10:37.591Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}