{"record":{"id":"e849ff89e29c8d61","repo":"Significant-Gravitas/AutoGPT","slug":"system-managed-credentials-cannot-be-deleted-e849ff","errorCode":null,"errorMessage":"System-managed credentials cannot be deleted","messagePattern":"System-managed credentials cannot be deleted","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"info","filePath":"autogpt_platform/backend/backend/api/features/integrations/router.py","lineNumber":637,"sourceCode":"\n@router.delete(\"/{provider}/credentials/{cred_id}\")\nasync def delete_credentials(\n    request: Request,\n    provider: Annotated[\n        ProviderName, Path(title=\"The provider to delete credentials for\")\n    ],\n    cred_id: Annotated[str, Path(title=\"The ID of the credentials to delete\")],\n    user_id: Annotated[str, Security(get_user_id)],\n    force: Annotated[\n        bool, Query(title=\"Whether to proceed if any linked webhooks are still in use\")\n    ] = False,\n) -> CredentialsDeletionResponse | CredentialsDeletionNeedsConfirmationResponse:\n    if is_sdk_default(cred_id):\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND, detail=\"Credentials not found\"\n        )\n    if is_system_credential(cred_id):\n        raise HTTPException(\n            status_code=status.HTTP_403_FORBIDDEN,\n            detail=\"System-managed credentials cannot be deleted\",\n        )\n    creds = await creds_manager.store.get_creds_by_id(user_id, cred_id)\n    if not creds:\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND, detail=\"Credentials not found\"\n        )\n    if not provider_matches(creds.provider, provider):\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND,\n            detail=\"Credentials not found\",\n        )\n    if creds.is_managed:\n        raise HTTPException(\n            status_code=status.HTTP_403_FORBIDDEN,\n            detail=\"AutoGPT-managed credentials cannot be deleted\",\n        )","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/integrations/router.py#L619-L655","documentation":"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.","triggerScenarios":"DELETE with the literal ID of a default credential, e.g. '744fdc56-071a-4761-b5a5-0af0ce10a2b5' (built-in ollama credential).","commonSituations":"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.","solutions":["Do not delete system credentials — they are expected to always exist","Hide system-managed credentials from delete actions in UI","In scripts, skip IDs returned by is_system_credential (SYSTEM_CREDENTIAL_IDS)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"SYSTEM_IDS = {c['id'] for c in default_credentials}  # mirror of SYSTEM_CREDENTIAL_IDS\nif cred_id in SYSTEM_IDS:\n    return  # not deletable by design","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model system credentials as non-deletable in client type/state"],"tags":["credentials","system-credentials","http-403"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}