{"record":{"id":"f8039d6778917f11","repo":"Significant-Gravitas/AutoGPT","slug":"graph-slv-agentgraphid-v-slv-agentgraphversion","errorCode":null,"errorMessage":"Graph {slv.agentGraphId} v{slv.agentGraphVersion} not found","messagePattern":"Graph (.+?) v(.+?) not found","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/store/db.py","lineNumber":1413,"sourceCode":"async def get_agent(store_listing_version_id: str) -> GraphModel:\n    \"\"\"Get agent using the version ID and store listing version ID.\"\"\"\n    slv = await prisma.models.StoreListingVersion.prisma().find_unique(\n        where={\"id\": store_listing_version_id}\n    )\n\n    if not slv:\n        raise NotFoundError(\n            f\"Store listing version {store_listing_version_id} not found\"\n        )\n\n    graph = await get_graph(\n        graph_id=slv.agentGraphId,\n        version=slv.agentGraphVersion,\n        user_id=None,\n        for_export=True,\n    )\n    if not graph:\n        raise NotFoundError(\n            f\"Graph {slv.agentGraphId} v{slv.agentGraphVersion} not found\"\n        )\n    return graph\n\n\n#####################################################\n################## ADMIN FUNCTIONS ##################\n#####################################################\n\n\nasync def review_store_submission(\n    store_listing_version_id: str,\n    is_approved: bool,\n    external_comments: str,\n    internal_comments: str,\n    reviewer_id: str,\n) -> store_model.StoreSubmissionAdminView:\n    \"\"\"Review a store listing submission as an admin.\"\"\"","sourceCodeStart":1395,"sourceCodeEnd":1431,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/store/db.py#L1395-L1431","documentation":"NotFoundError raised by store_db.get_agent() when the StoreListingVersion row exists but get_graph(for_export=True) returns None for slv.agentGraphId / slv.agentGraphVersion. It signals referential drift: the listing version points at an AgentGraph version that is gone or was never created.","triggerScenarios":"Store listing metadata survives while the referenced AgentGraph (or that specific version number) was deleted by its owner, rolled back by a migration, or written with a mismatched version during a failed submission.","commonSituations":"Data-restore from a partial dump, manual DB edits, concurrent submission + graph deletion, or a schema migration that reset graph version counters.","solutions":["Query the pair directly: check AgentGraph for id = slv.agentGraphId AND version = slv.agentGraphVersion.","If the graph is truly gone, remove or resubmit the orphaned StoreListingVersion so the store stops referencing it.","If versions drifted, re-align slv.agentGraphVersion with the max existing version or recreate the graph version.","Add a cleanup script/admin action for orphaned listing versions if this recurs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"slv = await prisma.models.StoreListingVersion.prisma().find_unique(\n    where={\"id\": store_listing_version_id}\n)\ngraph_exists = slv is not None and (\n    await prisma.models.AgentGraph.prisma().find_first(\n        where={\"id\": slv.agentGraphId, \"version\": slv.agentGraphVersion}\n    )\n) is not None","typeGuard":null,"tryCatchPattern":"try:\n    graph = await store_db.get_agent(store_listing_version_id)\nexcept NotFoundError as e:\n    if \"Graph\" in str(e):\n        logger.error(f\"Orphaned listing version {store_listing_version_id}: {e}\")\n    raise","preventionTips":["Delete store listing versions in the same transaction/flow as their graphs.","Periodically audit StoreListingVersion rows whose (agentGraphId, agentGraphVersion) pair has no AgentGraph match."],"tags":["store","data-integrity","not-found","prisma"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}