Significant-Gravitas/AutoGPT · info · HTTPException

System-managed credentials cannot be deleted

Error message

System-managed credentials cannot be deleted

What it means

DELETE /integrations/{provider}/credentials/{cred_id} returns 403 'System-managed credentials cannot be deleted' when the cred_id is in SYSTEM_CREDENTIAL_IDS — the hardcoded set of DEFAULT_CREDENTIALS ids from credentials_store.py (e.g. the built-in ollama fake-key credential). These are platform-level defaults shared across users, so individual deletion is forbidden.

Source

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

@router.delete("/{provider}/credentials/{cred_id}")
async def delete_credentials(
    request: Request,
    provider: Annotated[
        ProviderName, Path(title="The provider to delete credentials for")
    ],
    cred_id: Annotated[str, Path(title="The ID of the credentials to delete")],
    user_id: Annotated[str, Security(get_user_id)],
    force: Annotated[
        bool, Query(title="Whether to proceed if any linked webhooks are still in use")
    ] = False,
) -> CredentialsDeletionResponse | CredentialsDeletionNeedsConfirmationResponse:
    if is_sdk_default(cred_id):
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND, detail="Credentials not found"
        )
    if is_system_credential(cred_id):
        raise HTTPException(
            status_code=status.HTTP_403_FORBIDDEN,
            detail="System-managed credentials cannot be deleted",
        )
    creds = await creds_manager.store.get_creds_by_id(user_id, cred_id)
    if not creds:
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND, detail="Credentials not found"
        )
    if not provider_matches(creds.provider, provider):
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND,
            detail="Credentials not found",
        )
    if creds.is_managed:
        raise HTTPException(
            status_code=status.HTTP_403_FORBIDDEN,
            detail="AutoGPT-managed credentials cannot be deleted",
        )

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Do not delete system credentials — they are expected to always exist
  2. Hide system-managed credentials from delete actions in UI
  3. In scripts, skip IDs returned by is_system_credential (SYSTEM_CREDENTIAL_IDS)
Defensive patterns

Strategy: validation

Validate before calling

SYSTEM_IDS = {c['id'] for c in default_credentials}  # mirror of SYSTEM_CREDENTIAL_IDS
if cred_id in SYSTEM_IDS:
    return  # not deletable by design

Prevention

When it happens

Trigger: DELETE with the literal ID of a default credential, e.g. '744fdc56-071a-4761-b5a5-0af0ce10a2b5' (built-in ollama credential).

Common situations: User tries to remove the pre-provisioned provider entry in the credentials UI; cleanup script enumerates all credential rows in the DB and deletes each.

Related errors


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