Significant-Gravitas/AutoGPT · warning · ValueError

Invalid resource_type '{resource_type}'. Must be one of: {',

Error message

Invalid resource_type '{resource_type}'. Must be one of: {', '.join(sorted(_VALID_RESOURCE_TYPES))}

What it means

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.

Source

Thrown at autogpt_platform/backend/backend/api/features/transfers/db.py:33

async def create_transfer(
    source_org_id: str,
    target_org_id: str,
    resource_type: str,
    resource_id: str,
    user_id: str,
    reason: str | None = None,
) -> TransferResponse:
    """Create a new transfer request from source org to target org.

    Validates:
    - resource_type is one of the allowed types
    - source and target orgs are different
    - target org exists
    - the resource exists and belongs to the source org
    """
    if resource_type not in _VALID_RESOURCE_TYPES:
        raise ValueError(
            f"Invalid resource_type '{resource_type}'. "
            f"Must be one of: {', '.join(sorted(_VALID_RESOURCE_TYPES))}"
        )

    if source_org_id == target_org_id:
        raise ValueError("Source and target organizations must be different")

    target_org = await prisma.organization.find_unique(where={"id": target_org_id})
    if target_org is None or target_org.deletedAt is not None:
        raise NotFoundError(f"Target organization {target_org_id} not found")

    await _validate_resource_ownership(resource_type, resource_id, source_org_id)

    tr = await prisma.transferrequest.create(
        data={
            "resourceType": resource_type,
            "resourceId": resource_id,
            "sourceOrganizationId": source_org_id,

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Use exactly 'AgentGraph' or 'StoreListing' as resource_type.
  2. 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.
  3. Validate on the client against the same allow-list before sending.

Example fix

// before
await create_transfer_request(resource_type="agent_graph", ...);

// after
await create_transfer_request(resource_type="AgentGraph", ...);
Defensive patterns

Strategy: validation

Validate before calling

VALID_RESOURCE_TYPES = {"AgentGraph", "StoreListing"}

def is_valid_resource_type(value: str) -> bool:
    return value in VALID_RESOURCE_TYPES

Type guard

from typing import Literal

ResourceType = Literal["AgentGraph", "StoreListing"]

def is_resource_type(value: str) -> bool:
    return value in ("AgentGraph", "StoreListing")

Try / catch

try:
    resp = await create_transfer_request(resource_type, ...)
except ValueError as e:
    if "resource_type" in str(e):
        show_client_error(str(e))  # 400-style feedback
        return
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/8655f6638cfcf653. Report an issue: GitHub.