Significant-Gravitas/AutoGPT · error · DatabaseError

Failed to edit store submission

Error message

Failed to edit store submission

What it means

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.

Source

Thrown at autogpt_platform/backend/backend/api/features/store/db.py:1145

        logger.debug(
            f"Updated existing listing version {store_listing_version_id} "
            f"for graph {current_version.agentGraphId}"
        )

        return store_model.StoreSubmission.from_listing_version(updated_version)

    except (
        store_exceptions.SubmissionNotFoundError,
        store_exceptions.UnauthorizedError,
        NotFoundError,
        store_exceptions.ListingExistsError,
        store_exceptions.InvalidOperationError,
    ):
        raise
    except prisma.errors.PrismaError as e:
        logger.error(f"Database error editing store submission: {e}")
        raise DatabaseError("Failed to edit store submission") from e


async def create_store_review(
    user_id: str,
    store_listing_version_id: str,
    score: int,
    comments: str | None = None,
) -> store_model.StoreReview:
    """Create a review for a store listing as a user to detail their experience"""
    try:
        data = prisma.types.StoreListingReviewUpsertInput(
            update=prisma.types.StoreListingReviewUpdateInput(
                score=score,
                comments=comments,
            ),
            create=prisma.types.StoreListingReviewCreateInput(
                reviewByUserId=user_id,
                storeListingVersionId=store_listing_version_id,

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Read the chained PrismaError in logs for the exact cause code.
  2. Refetch the submission before saving; if its status/version changed, rebase the edit on fresh data.
  3. Send only currently-valid category IDs fetched at save time.
Defensive patterns

Strategy: try-catch

Try / catch

from backend.util.exceptions import DatabaseError
from backend.api.features.store import store_exceptions

try:
    await store_db.edit_store_submission(...)
except (store_exceptions.SubmissionNotFoundError, store_exceptions.UnauthorizedError):
    ui.refreshSubmissions()  # expected domain failures
except DatabaseError as e:
    cause = e.__cause__
    if getattr(cause, 'code', None) in ('P2003', 'P2025'):
        ui.show('This submission changed — reload and retry')
    else:
        raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/6922aa15f8aa40ae. Report an issue: GitHub.