{"record":{"id":"4a916c1d41f40ff7","repo":"Significant-Gravitas/AutoGPT","slug":"failed-to-fetch-creator-details","errorCode":null,"errorMessage":"Failed to fetch creator details","messagePattern":"Failed to fetch creator details","errorType":"exception","errorClass":"DatabaseError","httpStatus":500,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/store/db.py","lineNumber":607,"sourceCode":"    logger.debug(f\"Getting store creator details for {username}\")\n\n    try:\n        # Query creator details from database\n        creator = await prisma.models.Creator.prisma().find_unique(\n            where={\"username\": username}\n        )\n\n        if not creator:\n            logger.warning(f\"Creator not found: {username}\")\n            raise store_exceptions.CreatorNotFoundError(f\"Creator {username} not found\")\n\n        logger.debug(f\"Found creator details for {username}\")\n        return store_model.CreatorDetails.from_db(creator)\n    except store_exceptions.CreatorNotFoundError:\n        raise\n    except Exception as e:\n        logger.error(f\"Error getting store creator details: {e}\")\n        raise DatabaseError(\"Failed to fetch creator details\") from e\n\n\nasync def _get_submission_stats(user_id: str) -> store_model.SubmissionStats:\n    \"\"\"Compute creator-wide submission aggregates in a single round-trip.\n\n    Uses Postgres FILTER clauses so all five aggregates land in one query —\n    cheaper than five separate counts/sums and immune to the pagination\n    undercount that client-side aggregation suffers from.\n    \"\"\"\n    # average_rating is weighted by review_count so a submission with 1,000\n    # reviews counts proportionally more than one with a single review;\n    # straight AVG would over-represent low-volume submissions.\n    sql = \"\"\"\n        SELECT\n            COUNT(*)::int                                          AS total,\n            COUNT(*) FILTER (WHERE status = 'APPROVED')::int       AS approved,\n            COUNT(*) FILTER (WHERE status = 'PENDING')::int        AS pending,\n            COALESCE(SUM(run_count), 0)::bigint                    AS total_runs,","sourceCodeStart":589,"sourceCodeEnd":625,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/store/db.py#L589-L625","documentation":"Catch-all DatabaseError from get_store_creator(username): wraps any failure while fetching the Creator row or converting it via CreatorDetails.from_db. CreatorNotFoundError is explicitly re-raised untouched, so this message means 'something other than not-found went wrong' — a real infrastructure or mapping failure. The original cause is in the logged 'Error getting store creator details' line.","triggerScenarios":"DB down or connection dropped during find_unique; CreatorDetails.from_db hitting a field mismatch after a schema change (e.g. new non-optional column that is null in old rows); Prisma client out of date with the schema.","commonSituations":"Deploying backend code without regenerating the Prisma client; a migration adding a required column with NULL backfill; transient network blips to managed Postgres.","solutions":["Check the chained cause in logs ('Error getting store creator details: ...').","If a from_db field mismatch: run the pending migration or make the model field optional, then 'poetry run prisma generate'.","If transient connectivity: retry the request once; verify DB health if it repeats."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from backend.util.exceptions import DatabaseError\nfrom backend.api.features.store import store_exceptions\n\ntry:\n    creator = await store_db.get_store_creator(username)\nexcept store_exceptions.CreatorNotFoundError:\n    return RedirectResponse('/store/creators')  # expected miss\nexcept DatabaseError:\n    return Response('Creator lookup unavailable', status_code=503)  # infra failure","preventionTips":["Distinguish CreatorNotFoundError (user-facing 404) from DatabaseError (infra 5xx) in handlers.","Regenerate the Prisma client when CreatorDetails.from_db shape changes.","Monitor the 'Error getting store creator details' log for field-mismatch causes after migrations."],"tags":["database","prisma","store","error-wrapping"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}