{"record":{"id":"b7c97231b5b8b94d","repo":"Significant-Gravitas/AutoGPT","slug":"cannot-create-credentials-with-a-reserved-id","errorCode":null,"errorMessage":"Cannot create credentials with a reserved ID","messagePattern":"Cannot create credentials with a reserved ID","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/integrations/router.py","lineNumber":571,"sourceCode":"            ),\n        )\n\n    return PickerTokenResponse(\n        access_token=credential.access_token.get_secret_value(),\n        access_token_expires_at=credential.access_token_expires_at,\n    )\n\n\n@router.post(\"/{provider}/credentials\", status_code=201, summary=\"Create Credentials\")\nasync def create_credentials(\n    user_id: Annotated[str, Security(get_user_id)],\n    provider: Annotated[\n        ProviderName, Path(title=\"The provider to create credentials for\")\n    ],\n    credentials: Credentials,\n) -> CredentialsMetaResponse:\n    if is_sdk_default(credentials.id):\n        raise HTTPException(\n            status_code=status.HTTP_403_FORBIDDEN,\n            detail=\"Cannot create credentials with a reserved ID\",\n        )\n    if provider == ProviderName.CODEX:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Codex credentials must be created through ChatGPT sign-in\",\n        )\n    if (\n        isinstance(credentials, OAuth2Credentials)\n        and credentials.refresh_strategy == \"provider_runtime\"\n    ):\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Provider-runtime credentials cannot be created directly\",\n        )\n    credentials.provider = provider\n    try:","sourceCodeStart":553,"sourceCodeEnd":589,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/integrations/router.py#L553-L589","documentation":"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.","triggerScenarios":"POST /integrations/{provider}/credentials with body containing \"id\": \"google-default\" (or any ID ending in '-default').","commonSituations":"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.","solutions":["Omit the id field entirely — the server default_factory mints a uuid4","Or send a random uuid4; any string NOT ending in '-default' is accepted"],"exampleFix":"// before\n{\"type\": \"api_key\", \"id\": \"groq-default\", \"provider\": \"groq\", ...}\n\n// after\n{\"type\": \"api_key\", \"provider\": \"groq\", ...}  // id omitted -> uuid4","handlingStrategy":"validation","validationCode":"if cred_id.endswith('-default'):\n    cred_id = None  # let the server assign a fresh uuid4","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never client-assign IDs in the reserved '-default' namespace"],"tags":["credentials","reserved-id","http-403"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}