{"record":{"id":"ebcb269744338dcf","repo":"Significant-Gravitas/AutoGPT","slug":"str-e-ebcb26","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/admin/execution_analytics_routes.py","lineNumber":345,"sourceCode":"        response = ExecutionAnalyticsResponse(\n            total_executions=len(executions),\n            processed_executions=len(executions_to_process),\n            successful_analytics=successful_count,\n            failed_analytics=failed_count,\n            skipped_executions=len(executions) - len(executions_to_process),\n            results=results,\n        )\n\n        logger.info(\n            f\"Analytics generation completed: {successful_count} successful, {failed_count} failed, \"\n            f\"{response.skipped_executions} skipped\"\n        )\n\n        return response\n\n    except Exception as e:\n        logger.exception(f\"Error during execution analytics generation: {e}\")\n        raise HTTPException(status_code=500, detail=str(e))\n\n\nasync def _process_batch(\n    executions, request: ExecutionAnalyticsRequest, db_client\n) -> list[ExecutionAnalyticsResult]:\n    \"\"\"Process a batch of executions concurrently.\"\"\"\n\n    if not settings.secrets.openai_internal_api_key:\n        raise HTTPException(status_code=500, detail=\"OpenAI API key not configured\")\n\n    async def process_single_execution(execution) -> ExecutionAnalyticsResult:\n        try:\n            # Generate activity status and score using the specified model\n            # Convert stats to GraphExecutionStats if needed\n            if execution.stats:\n                if isinstance(execution.stats, GraphExecutionMeta.Stats):\n                    stats_for_generation = execution.stats.to_db()\n                else:","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/admin/execution_analytics_routes.py#L327-L363","documentation":"HTTP 500 from the admin execution-analytics generation endpoint. An unexpected exception escaped the generation loop (per-execution failures are counted as failed_count, so this indicates something systemic — DB fetch of executions, request assembly, or the final response build) and str(e) is returned as the detail. The full traceback is in the server log via logger.exception.","triggerScenarios":"POST /admin/execution-analytics where a non-per-execution step throws: e.g. get_graph_executions failing on malformed stats JSON, a Pydantic validation error building ExecutionAnalyticsResponse, or serialization of unanticipated stats shapes.","commonSituations":"First analytics run against legacy executions whose stats predate the current schema; a model rename breaking GraphExecutionMeta.Stats conversion; DB connectivity blips mid-generation.","solutions":["Read the server traceback (the response detail is only str(e)) to identify the throwing frame.","If legacy stats are involved, exclude old executions via the request's date/id filters and retry.","Fix or migrate the malformed data the traceback points to.","Re-run the request on a narrower execution set to isolate the offending record."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const r = await generateExecutionAnalytics(req); } catch (e) { if (e.status === 500) { logServerError(e.detail); await retryWithNarrowerScope(req); /* fewer executions per batch */ } }","preventionTips":["Narrow the execution set (date filters, graph ids) on first runs to isolate bad records.","Regenerate analytics after schema migrations so rows match the current shapes.","Always pair client 500 handling with a server-log check — the detail alone lacks the stack."],"tags":["http-500","admin-api","analytics","unhandled-exception"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}