Significant-Gravitas/AutoGPT · error · DatabaseError

Failed to create store submission

Error message

Failed to create store submission

What it means

Generic wrapper: any prisma.errors.PrismaError raised during create_store_submission that is not a UniqueViolationError, NotFoundError, or ListingExistsError is logged ('Database error creating store submission') and re-raised as this DatabaseError. This is the residual bucket — connectivity loss mid-transaction, FK violations on categories/relations, data too long for columns, etc.

Source

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

        if "slug" in error_str.lower():
            logger.debug(f"Slug '{slug}' is already in use by graph #{graph_id}")
            raise store_exceptions.SlugAlreadyInUseError(
                f"The slug '{slug}' is already in use by another one of your agents. "
                "Please choose a different slug."
            ) from exc
        else:
            # Reraise as a generic database error for other unique violations
            raise DatabaseError(
                f"Unique constraint violated (not slug): {error_str}"
            ) from exc
    except (
        NotFoundError,
        store_exceptions.ListingExistsError,
    ):
        raise
    except prisma.errors.PrismaError as e:
        logger.error(f"Database error creating store submission: {e}")
        raise DatabaseError("Failed to create store submission") from e


async def edit_store_submission(
    user_id: str,
    store_listing_version_id: str,
    name: str,
    video_url: str | None = None,
    agent_output_demo_url: str | None = None,
    image_urls: list[str] = [],
    description: str = "",
    sub_heading: str = "",
    categories: list[str] = [],
    changes_summary: str | None = "Update submission",
    recommended_schedule_cron: str | None = None,
    instructions: str | None = None,
    organization_id: str | None = None,
) -> store_model.StoreSubmission:
    """

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Inspect the chained PrismaError in server logs to identify the concrete cause (P2003 FK, P2028 timeout, etc.).
  2. For P2003: fetch fresh categories from the store API and send only valid ones.
  3. For timeouts/connectivity: verify DB health and retry once; check transaction timeout settings.
  4. For length issues, trim user inputs client-side to sane limits.

Example fix

// before
await api.createSubmission({ ...payload, categories: selectedCategoryLabels });
// after
const valid = await api.getCategories();
const ids = selectedCategoryLabels.map(l => valid.find(c => c.name === l)?.id).filter(Boolean);
await api.createSubmission({ ...payload, categories: ids });
Defensive patterns

Strategy: try-catch

Validate before calling

const validCategories = await api.getCategories();
const validNames = new Set(validCategories.map(c => c.name));
payload.categories = payload.categories.filter(c => validNames.has(c));

Try / catch

from backend.util.exceptions import DatabaseError

try:
    await store_db.create_store_submission(...)
except DatabaseError as e:
    cause = e.__cause__
    if getattr(cause, 'code', None) == 'P2003':
        ui.show('One of the selected categories no longer exists — refresh and retry');
    elif getattr(cause, 'code', None) == 'P2028':
        retry_once()
    else:
        raise

Prevention

When it happens

Trigger: FK violation when submitting with a category name that doesn't exist in the Category table; connection drop during the transaction; a field exceeding its column length (very long slugs/names after sanitization); transaction timeout.

Common situations: Frontend sending category labels instead of existing category IDs; stale category list in the UI after categories were renamed; flaky DB connection in CI.

Related errors


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