{"record":{"id":"a76c8890c34d020f","repo":"Significant-Gravitas/AutoGPT","slug":"storelisting-does-not-belong-to-the-source-organiz","errorCode":null,"errorMessage":"StoreListing does not belong to the source organization","messagePattern":"StoreListing does not belong to the source organization","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/transfers/db.py","lineNumber":221,"sourceCode":"async def _validate_resource_ownership(\n    resource_type: str, resource_id: str, org_id: str\n) -> None:\n    \"\"\"Verify the resource exists and belongs to the given org.\"\"\"\n    if resource_type == \"AgentGraph\":\n        graph = await prisma.agentgraph.find_first(\n            where={\"id\": resource_id, \"isActive\": True}\n        )\n        if graph is None:\n            raise NotFoundError(f\"AgentGraph '{resource_id}' not found\")\n        if graph.organizationId != org_id:\n            raise ValueError(\"AgentGraph does not belong to the source organization\")\n\n    elif resource_type == \"StoreListing\":\n        listing = await prisma.storelisting.find_unique(where={\"id\": resource_id})\n        if listing is None or listing.isDeleted:\n            raise NotFoundError(f\"StoreListing '{resource_id}' not found\")\n        if listing.owningOrgId != org_id:\n            raise ValueError(\"StoreListing does not belong to the source organization\")\n\n\nasync def _move_resource(\n    resource_type: str,\n    resource_id: str,\n    target_org_id: str,\n) -> None:\n    \"\"\"Move the resource to the target organization.\"\"\"\n    if resource_type == \"AgentGraph\":\n        # Move ALL versions, not just the active one, and land the graph at\n        # org-home (teamId=None) — a stale source-org teamId would fail every\n        # clause of the target org's visibility_filter, making the graph\n        # invisible to all target-org members.\n        await prisma.agentgraph.update_many(\n            where={\"id\": resource_id},\n            data={\"organizationId\": target_org_id, \"teamId\": None},\n        )\n","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/transfers/db.py#L203-L239","documentation":"Error \"StoreListing does not belong to the source organization\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/features/transfers/db.py:221 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Transfer the listing from the organization that actually owns it.","Move the listing to the source org first if appropriate."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}