{"record":{"id":"8655f6638cfcf653","repo":"Significant-Gravitas/AutoGPT","slug":"invalid-resource-type-resource-type-must-be-o","errorCode":null,"errorMessage":"Invalid resource_type '{resource_type}'. Must be one of: {', '.join(sorted(_VALID_RESOURCE_TYPES))}","messagePattern":"Invalid resource_type '(.+?)'\\. Must be one of: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/transfers/db.py","lineNumber":33,"sourceCode":"\nasync def create_transfer(\n    source_org_id: str,\n    target_org_id: str,\n    resource_type: str,\n    resource_id: str,\n    user_id: str,\n    reason: str | None = None,\n) -> TransferResponse:\n    \"\"\"Create a new transfer request from source org to target org.\n\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,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/transfers/db.py#L15-L51","documentation":"ValueError from transfers create_transfer_request() when resource_type is not in the module-level allow-list _VALID_RESOURCE_TYPES = {'AgentGraph', 'StoreListing'}. It is input validation on the transfer API and maps to a 400-class client error, not a server fault.","triggerScenarios":"POST a transfer request with resource_type like 'agent_graph', 'agentGraph', 'agent', 'Block' or any future type not yet added to the set — the check is case- and spelling-sensitive.","commonSituations":"Client code guessing the enum instead of reading the schema; new resource types introduced in the UI before the backend set was extended; copy-paste from API docs with the wrong casing.","solutions":["Use exactly 'AgentGraph' or 'StoreListing' as resource_type.","If a new type is genuinely needed, add it to _VALID_RESOURCE_TYPES (and its ownership validator in _validate_resource_ownership) in transfers/db.py.","Validate on the client against the same allow-list before sending."],"exampleFix":"// before\nawait create_transfer_request(resource_type=\"agent_graph\", ...);\n\n// after\nawait create_transfer_request(resource_type=\"AgentGraph\", ...);","handlingStrategy":"validation","validationCode":"VALID_RESOURCE_TYPES = {\"AgentGraph\", \"StoreListing\"}\n\ndef is_valid_resource_type(value: str) -> bool:\n    return value in VALID_RESOURCE_TYPES","typeGuard":"from typing import Literal\n\nResourceType = Literal[\"AgentGraph\", \"StoreListing\"]\n\ndef is_resource_type(value: str) -> bool:\n    return value in (\"AgentGraph\", \"StoreListing\")","tryCatchPattern":"try:\n    resp = await create_transfer_request(resource_type, ...)\nexcept ValueError as e:\n    if \"resource_type\" in str(e):\n        show_client_error(str(e))  # 400-style feedback\n        return\n    raise","preventionTips":["Type resource_type as a closed Literal/enum in clients so invalid values fail at compile time.","Keep client allow-lists in sync with _VALID_RESOURCE_TYPES in transfers/db.py."],"tags":["transfers","validation","backend"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}