{"record":{"id":"cc7f16b335d51122","repo":"Significant-Gravitas/AutoGPT","slug":"agent-graph-id-v-graph-version-not-found-for-t","errorCode":null,"errorMessage":"Agent #{graph_id} v{graph_version} not found for this user (#{user_id})","messagePattern":"Agent #(.+?) v(.+?) not found for this user \\(#(.+?)\\)","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/store/db.py","lineNumber":902,"sourceCode":"\n        # First verify the agent graph belongs to this user\n        graph = await prisma.models.AgentGraph.prisma().find_first(\n            where={\"id\": graph_id, \"version\": graph_version, \"userId\": user_id},\n            include={\"User\": {\"include\": {\"Profile\": True}}},\n        )\n\n        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\"},","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/store/db.py#L884-L920","documentation":"NotFoundError raised when no AgentGraph row matches the triple {id: graph_id, version: graph_version, userId: user_id}. All three must match: the graph must exist, at that exact version, and be owned by the authenticated user. Maps to HTTP 404 at the API layer. The most common non-obvious cause is the version mismatch — graphs are versioned, and submitting requires the version number you actually have.","triggerScenarios":"POST /store/submissions with a graph_id belonging to another user; a stale graph_id after the agent was deleted; graph_version mismatch (e.g. sending 1 when the saved graph is version 4); sending the graph name instead of its UUID.","commonSituations":"Agent deleted in another tab before publishing; concurrent edits bumping the version after the dialog opened; environment mismatch (submitting an ID from a local DB to staging); frontend sending graph.version as a string.","solutions":["Refetch the user's agents list and resubmit with the current id/version pair.","Confirm the authenticated user owns the graph — submissions on behalf of another user are not supported.","Check the deleted-agents path: if the graph was removed, re-create it or pick another agent.","Verify environment consistency (same backend the agent list came from)."],"exampleFix":"// before\nawait api.createSubmission({ graph_id: params.graphId, graph_version: 1, ... });\n// after\nconst graph = (await api.getMyAgents()).find(a => a.id === params.graphId);\nif (!graph) throw new Error('Agent not found — refresh and select it again');\nawait api.createSubmission({ graph_id: graph.id, graph_version: graph.version, ... });","handlingStrategy":"validation","validationCode":"const mine = await api.getMyAgents();\nconst owned = mine.find(a => a.id === form.graph_id && a.version === form.graph_version);\nif (!owned) {\n  setError('This agent was changed or deleted — refresh and select it again');\n  return;\n}\nawait api.createSubmission(form);","typeGuard":null,"tryCatchPattern":"from backend.util.exceptions import NotFoundError\n\ntry:\n    await store_db.create_store_submission(...)\nexcept NotFoundError as e:\n    if 'not found for this user' in str(e):\n        ui.refreshAgentList();\n        ui.show('Agent not found; it may have been edited or deleted');\n        return;\n    raise","preventionTips":["Always send the graph's current version from freshly fetched state.","Handle 404 on submission by refetching the agent list, not by blind retry.","Scope agent pickers to the authenticated user's library only."],"tags":["not-found","ownership","submission","store","versioning"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}