Significant-Gravitas/AutoGPT · error · HTTPException

Cannot create credentials with a reserved ID

Error message

Cannot create credentials with a reserved ID

What it means

POST /integrations/{provider}/credentials returns 403 'Cannot create credentials with a reserved ID' when the submitted credentials.id ends with '-default' (is_sdk_default). The '-default' suffix namespace is reserved for SDK default credentials and cannot be claimed through the public create endpoint.

Source

Thrown at autogpt_platform/backend/backend/api/features/integrations/router.py:571

            ),
        )

    return PickerTokenResponse(
        access_token=credential.access_token.get_secret_value(),
        access_token_expires_at=credential.access_token_expires_at,
    )


@router.post("/{provider}/credentials", status_code=201, summary="Create Credentials")
async def create_credentials(
    user_id: Annotated[str, Security(get_user_id)],
    provider: Annotated[
        ProviderName, Path(title="The provider to create credentials for")
    ],
    credentials: Credentials,
) -> CredentialsMetaResponse:
    if is_sdk_default(credentials.id):
        raise HTTPException(
            status_code=status.HTTP_403_FORBIDDEN,
            detail="Cannot create credentials with a reserved ID",
        )
    if provider == ProviderName.CODEX:
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail="Codex credentials must be created through ChatGPT sign-in",
        )
    if (
        isinstance(credentials, OAuth2Credentials)
        and credentials.refresh_strategy == "provider_runtime"
    ):
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail="Provider-runtime credentials cannot be created directly",
        )
    credentials.provider = provider
    try:

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Omit the id field entirely — the server default_factory mints a uuid4
  2. Or send a random uuid4; any string NOT ending in '-default' is accepted

Example fix

// before
{"type": "api_key", "id": "groq-default", "provider": "groq", ...}

// after
{"type": "api_key", "provider": "groq", ...}  // id omitted -> uuid4
Defensive patterns

Strategy: validation

Validate before calling

if cred_id.endswith('-default'):
    cred_id = None  # let the server assign a fresh uuid4

Prevention

When it happens

Trigger: POST /integrations/{provider}/credentials with body containing "id": "google-default" (or any ID ending in '-default').

Common situations: Client echoes back an ID it saw in SDK-generated config; test fixture reuses a default ID; user copies a doc example containing a default-style ID.

Related errors


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