{"record":{"id":"8dead8aa773c9503","repo":"Significant-Gravitas/AutoGPT","slug":"user-must-create-a-marketplace-profile-before-subm","errorCode":null,"errorMessage":"User must create a Marketplace Profile before submitting an agent","messagePattern":"User must create a Marketplace Profile before submitting an agent","errorType":"exception","errorClass":"PreconditionFailed","httpStatus":428,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/store/db.py","lineNumber":909,"sourceCode":"        if not graph:\n            logger.warning(\n                f\"Agent graph {graph_id} v{graph_version} not found for user {user_id}\"\n            )\n            # Provide more user-friendly error message when graph_id is empty\n            if not graph_id or graph_id.strip() == \"\":\n                raise ValueError(\n                    \"No agent selected. \"\n                    \"Please select an agent before submitting to the store.\"\n                )\n            else:\n                raise NotFoundError(\n                    f\"Agent #{graph_id} v{graph_version} not found \"\n                    f\"for this user (#{user_id})\"\n                )\n\n        if not graph.User or not graph.User.Profile:\n            logger.warning(f\"User #{user_id} does not have a Profile\")\n            raise PreconditionFailed(\n                \"User must create a Marketplace Profile before submitting an agent\"\n            )\n\n        async with transaction() as tx:\n            # Determine next version number for this listing\n            existing_listing = await prisma.models.StoreListing.prisma(tx).find_unique(\n                where={\"agentGraphId\": graph_id},\n                include={\n                    \"Versions\": {\n                        # We just need the latest version and one of each status:\n                        \"order_by\": {\"version\": \"desc\"},\n                        \"distinct\": [\"submissionStatus\"],\n                        \"where\": {\"isDeleted\": False},\n                    }\n                },\n            )\n            next_version = 1\n            graph_has_pending_submissions = False","sourceCodeStart":891,"sourceCodeEnd":927,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/store/db.py#L891-L927","documentation":"PreconditionFailed raised when the submitting user's User record has no Profile row (or the User relation did not load). The store requires a marketplace profile (username, display name) because the listing's CreatorProfile is derived from it. This is a 'do something else first' error: create the profile, then resubmit. Same shape as error 406: state must be fixed before retrying.","triggerScenarios":"POST /store/submissions by a brand-new account that never opened the marketplace profile settings; a user whose Profile row was deleted; submitting immediately after signup before profile creation.","commonSituations":"First-time publishers skipping the 'Create your creator profile' step; E2E tests using fresh seeded users without profiles; profile creation call failed silently earlier in the session.","solutions":["Call the profile endpoints (PUT /store/profile) to create the marketplace profile, then retry the submission.","In the UI, route users through a profile-creation step before showing the publish dialog.","For tests/seeds, ensure the user fixture includes a Profile row."],"exampleFix":"// before\nawait api.createSubmission(payload); // fails: no Profile\n// after\nlet profile = await api.getMyProfile();\nif (!profile) profile = await api.updateProfile({ name: user.name, username: user.handle });\nawait api.createSubmission(payload);","handlingStrategy":"validation","validationCode":"let profile = await api.getMyStoreProfile();\nif (!profile) {\n  profile = await api.updateStoreProfile({ name: defaultName, username: suggestUsername() });\n}\nawait api.createSubmission(payload);","typeGuard":null,"tryCatchPattern":"from backend.util.exceptions import PreconditionFailed\n\ntry:\n    await store_db.create_store_submission(...)\nexcept PreconditionFailed as e:\n    if 'Marketplace Profile' in str(e):\n        ui.openProfileCreationWizard();\n        return;\n    raise","preventionTips":["Gate the publish flow behind a profile-existence check.","Pre-create profiles during onboarding if marketplace participation is expected.","Give test users Profile rows in fixtures."],"tags":["precondition","profile","submission","store","onboarding"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}