{"record":{"id":"6922aa15f8aa40ae","repo":"Significant-Gravitas/AutoGPT","slug":"failed-to-edit-store-submission","errorCode":null,"errorMessage":"Failed to edit store submission","messagePattern":"Failed to edit store submission","errorType":"exception","errorClass":"DatabaseError","httpStatus":500,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/store/db.py","lineNumber":1145,"sourceCode":"\n        logger.debug(\n            f\"Updated existing listing version {store_listing_version_id} \"\n            f\"for graph {current_version.agentGraphId}\"\n        )\n\n        return store_model.StoreSubmission.from_listing_version(updated_version)\n\n    except (\n        store_exceptions.SubmissionNotFoundError,\n        store_exceptions.UnauthorizedError,\n        NotFoundError,\n        store_exceptions.ListingExistsError,\n        store_exceptions.InvalidOperationError,\n    ):\n        raise\n    except prisma.errors.PrismaError as e:\n        logger.error(f\"Database error editing store submission: {e}\")\n        raise DatabaseError(\"Failed to edit store submission\") from e\n\n\nasync def create_store_review(\n    user_id: str,\n    store_listing_version_id: str,\n    score: int,\n    comments: str | None = None,\n) -> store_model.StoreReview:\n    \"\"\"Create a review for a store listing as a user to detail their experience\"\"\"\n    try:\n        data = prisma.types.StoreListingReviewUpsertInput(\n            update=prisma.types.StoreListingReviewUpdateInput(\n                score=score,\n                comments=comments,\n            ),\n            create=prisma.types.StoreListingReviewCreateInput(\n                reviewByUserId=user_id,\n                storeListingVersionId=store_listing_version_id,","sourceCodeStart":1127,"sourceCodeEnd":1163,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/store/db.py#L1127-L1163","documentation":"Generic wrapper for edit_store_submission: any prisma.errors.PrismaError not already handled (SubmissionNotFoundError, UnauthorizedError, NotFoundError, ListingExistsError, InvalidOperationError are re-raised as-is) becomes this DatabaseError. The true cause is in the 'Database error editing store submission' log line and the chained exception.","triggerScenarios":"Editing a submission whose listing version was deleted between the fetch and the update; connection failure during update; passing categories that no longer exist (FK violation on the version-category join).","commonSituations":"Stale edit dialog left open while the submission was reviewed/approved elsewhere; moderation flow changing submission status mid-edit; category taxonomy renamed under an open form.","solutions":["Read the chained PrismaError in logs for the exact cause code.","Refetch the submission before saving; if its status/version changed, rebase the edit on fresh data.","Send only currently-valid category IDs fetched at save time."],"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    await store_db.edit_store_submission(...)\nexcept (store_exceptions.SubmissionNotFoundError, store_exceptions.UnauthorizedError):\n    ui.refreshSubmissions()  # expected domain failures\nexcept DatabaseError as e:\n    cause = e.__cause__\n    if getattr(cause, 'code', None) in ('P2003', 'P2025'):\n        ui.show('This submission changed — reload and retry')\n    else:\n        raise","preventionTips":["Handle the domain-specific exceptions (SubmissionNotFoundError etc.) separately from the generic DatabaseError.","Refetch the submission at save time to catch mid-edit status changes by moderation.","Validate category IDs against the live taxonomy before submitting edits."],"tags":["database","prisma","submission","store","error-wrapping"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}