{"record":{"id":"68a7cc5765eccc39","repo":"Significant-Gravitas/AutoGPT","slug":"target-organization-target-org-id-not-found","errorCode":null,"errorMessage":"Target organization {target_org_id} not found","messagePattern":"Target organization (.+?) not found","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/transfers/db.py","lineNumber":43,"sourceCode":"\n    Validates:\n    - resource_type is one of the allowed types\n    - source and target orgs are different\n    - target org exists\n    - the resource exists and belongs to the source org\n    \"\"\"\n    if resource_type not in _VALID_RESOURCE_TYPES:\n        raise ValueError(\n            f\"Invalid resource_type '{resource_type}'. \"\n            f\"Must be one of: {', '.join(sorted(_VALID_RESOURCE_TYPES))}\"\n        )\n\n    if source_org_id == target_org_id:\n        raise ValueError(\"Source and target organizations must be different\")\n\n    target_org = await prisma.organization.find_unique(where={\"id\": target_org_id})\n    if target_org is None or target_org.deletedAt is not None:\n        raise NotFoundError(f\"Target organization {target_org_id} not found\")\n\n    await _validate_resource_ownership(resource_type, resource_id, source_org_id)\n\n    tr = await prisma.transferrequest.create(\n        data={\n            \"resourceType\": resource_type,\n            \"resourceId\": resource_id,\n            \"sourceOrganizationId\": source_org_id,\n            \"targetOrganizationId\": target_org_id,\n            \"initiatedByUserId\": user_id,\n            \"status\": \"PENDING\",\n            \"reason\": reason,\n        }\n    )\n    return TransferResponse.from_db(tr)\n\n\nasync def list_transfers(org_id: str) -> list[TransferResponse]:","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/transfers/db.py#L25-L61","documentation":"NotFoundError from create_transfer_request() when prisma.organization.find_unique(target_org_id) returns None OR the row's deletedAt is set — the platform soft-deletes organizations, so a tombstoned org is treated as nonexistent even though its row remains.","triggerScenarios":"Transfer request targeting an org ID that was never created, was hard-missing in this environment, or was soft-deleted (deletedAt non-null) after the user's org picker cached it.","commonSituations":"Stale org list in the client after an org was dissolved; environment mismatch where the org exists in staging but not prod; typo'd org UUID.","solutions":["Refresh the organizations list and pick a currently active org.","Verify the org row: `SELECT id, \"deletedAt\" FROM \"Organization\" WHERE id = '<uuid>'` — if deletedAt is set the org is gone.","If it must be restored, un-delete via admin tooling before retrying the transfer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"org = await prisma.organization.find_unique(where={\"id\": target_org_id})\ntarget_org_active = org is not None and org.deletedAt is None","typeGuard":null,"tryCatchPattern":"try:\n    resp = await create_transfer_request(...)\nexcept NotFoundError as e:\n    if \"Target organization\" in str(e):\n        refresh_org_picker()  # drop deleted orgs\n        return\n    raise","preventionTips":["Filter soft-deleted orgs (deletedAt != null) out of org pickers.","Re-validate the target org at submit time, not just at page load."],"tags":["transfers","not-found","organizations","soft-delete"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}