{"record":{"id":"3f4ecb682827d348","repo":"Significant-Gravitas/AutoGPT","slug":"credentials-not-found","errorCode":null,"errorMessage":"Credentials not found","messagePattern":"Credentials not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/external/v1/integrations.py","lineNumber":630,"sourceCode":"    \"/{provider}/credentials/{cred_id}\",\n    response_model=DeleteCredentialResponse,\n)\nasync def delete_credential(\n    provider: Annotated[str, Path(title=\"The provider\")],\n    cred_id: Annotated[str, Path(title=\"The credential ID to delete\")],\n    auth: APIAuthorizationInfo = Security(\n        require_permission(APIKeyPermission.DELETE_INTEGRATIONS)\n    ),\n) -> DeleteCredentialResponse:\n    \"\"\"\n    Delete a credential.\n\n    Note: This does not revoke the tokens with the provider. For full cleanup,\n    use the main API's delete endpoint which handles webhook cleanup and\n    token revocation.\n    \"\"\"\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(auth.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, detail=\"Credentials not found\"\n        )\n\n    await creds_manager.delete(auth.user_id, cred_id)","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/external/v1/integrations.py#L612-L648","documentation":"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.","triggerScenarios":"DELETE `/api/external-api/v1/integrations/{provider}/credentials/{cred_id}` where `cred_id` matches an id in the platform's DEFAULT_CREDENTIALS table.","commonSituations":"Listing integrations and trying to delete a platform-provided default credential; hardcoding known default credential ids in cleanup scripts.","solutions":["Skip SDK-default credential ids when scripting deletions; they are platform-managed and cannot be removed via the API.","Only delete credentials you created yourself (ids returned by the create/OAuth-complete endpoints)."],"exampleFix":"# before\nDELETE /integrations/llm/credentials/<sdk-default-id>  # 404\n\n# after: filter defaults out before deleting\nfor c in list_credentials(provider):\n    if not is_sdk_default(c.id):\n        DELETE /integrations/{provider}/credentials/{c.id}","handlingStrategy":"validation","validationCode":"# SDK-default ids are fixed constants; skip them before deleting\nSDK_DEFAULT_IDS = load_sdk_default_ids()  # from platform docs/constants\nif cred_id in SDK_DEFAULT_IDS:\n    skip(\"SDK default credential; not deletable\")","typeGuard":null,"tryCatchPattern":"try:\n    client.delete(f\"/integrations/{provider}/credentials/{cred_id}\")\nexcept HTTPError as e:\n    if e.response.status_code == 404:\n        pass  # treat as already gone / not user-deletable\n    else:\n        raise","preventionTips":["Only delete credential ids your client created (returned by create/OAuth-complete).","Treat 404 on delete as idempotent success in cleanup scripts."],"tags":["credentials","delete","not-found","sdk-defaults"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}