Significant-Gravitas/AutoGPT · error · HTTPException

Credentials not found

Error message

Credentials not found

What it means

Raised (HTTP 404) at the top of the external delete-credential endpoint when the credential id belongs to the SDK-default credential set (`is_sdk_default(cred_id)` checks against built-in default credentials shipped with the platform). SDK defaults are shared, not user-owned, so they are reported as 'not found' rather than deletable — deliberately hiding their existence from the per-user API.

Source

Thrown at autogpt_platform/backend/backend/api/external/v1/integrations.py:630

    "/{provider}/credentials/{cred_id}",
    response_model=DeleteCredentialResponse,
)
async def delete_credential(
    provider: Annotated[str, Path(title="The provider")],
    cred_id: Annotated[str, Path(title="The credential ID to delete")],
    auth: APIAuthorizationInfo = Security(
        require_permission(APIKeyPermission.DELETE_INTEGRATIONS)
    ),
) -> DeleteCredentialResponse:
    """
    Delete a credential.

    Note: This does not revoke the tokens with the provider. For full cleanup,
    use the main API's delete endpoint which handles webhook cleanup and
    token revocation.
    """
    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(auth.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"
        )

    await creds_manager.delete(auth.user_id, cred_id)

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Skip SDK-default credential ids when scripting deletions; they are platform-managed and cannot be removed via the API.
  2. Only delete credentials you created yourself (ids returned by the create/OAuth-complete endpoints).

Example fix

# before
DELETE /integrations/llm/credentials/<sdk-default-id>  # 404

# after: filter defaults out before deleting
for c in list_credentials(provider):
    if not is_sdk_default(c.id):
        DELETE /integrations/{provider}/credentials/{c.id}
Defensive patterns

Strategy: validation

Validate before calling

# SDK-default ids are fixed constants; skip them before deleting
SDK_DEFAULT_IDS = load_sdk_default_ids()  # from platform docs/constants
if cred_id in SDK_DEFAULT_IDS:
    skip("SDK default credential; not deletable")

Try / catch

try:
    client.delete(f"/integrations/{provider}/credentials/{cred_id}")
except HTTPError as e:
    if e.response.status_code == 404:
        pass  # treat as already gone / not user-deletable
    else:
        raise

Prevention

When it happens

Trigger: DELETE `/api/external-api/v1/integrations/{provider}/credentials/{cred_id}` where `cred_id` matches an id in the platform's DEFAULT_CREDENTIALS table.

Common situations: Listing integrations and trying to delete a platform-provided default credential; hardcoding known default credential ids in cleanup scripts.

Related errors


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