{"record":{"id":"38f431b3eeb026f8","repo":"Significant-Gravitas/AutoGPT","slug":"provider-provider-not-found","errorCode":null,"errorMessage":"Provider '{provider}' not found","messagePattern":"Provider '(.+?)' not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/external/v1/integrations.py","lineNumber":352,"sourceCode":"    for CSRF protection.\n    \"\"\"\n    # Validate callback URL\n    if not validate_callback_url(request.callback_url):\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=(\n                f\"Callback URL origin is not allowed. \"\n                f\"Allowed origins: {settings.config.external_oauth_callback_origins}\",\n            ),\n        )\n\n    # Validate provider\n    try:\n        provider_name = ProviderName(provider)\n    except ValueError:\n        # Check if it's a dynamically registered provider\n        if provider not in HANDLERS_BY_NAME:\n            raise HTTPException(\n                status_code=status.HTTP_404_NOT_FOUND,\n                detail=f\"Provider '{provider}' not found\",\n            )\n        provider_name = provider\n\n    # Get OAuth handler with external callback URL\n    handler = _get_oauth_handler_for_external(\n        provider if isinstance(provider_name, str) else provider_name.value,\n        request.callback_url,\n    )\n\n    # Store state token with external flow metadata\n    # Note: initiated_by_api_key_id is only available for API key auth, not OAuth\n    api_key_id = getattr(auth, \"id\", None) if auth.type == \"api_key\" else None\n    state_token, code_challenge = await creds_manager.store.store_state_token(\n        user_id=auth.user_id,\n        provider=provider if isinstance(provider_name, str) else provider_name.value,\n        scopes=request.scopes,","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/external/v1/integrations.py#L334-L370","documentation":"Raised (HTTP 404) by the external OAuth initiate endpoint when the `provider` path parameter is neither a member of the `ProviderName` enum nor a dynamically registered provider key in `HANDLERS_BY_NAME`. The endpoint first tries `ProviderName(provider)`; on ValueError it falls back to the dynamic handler registry (populated after block loading), and 404s if the name is unknown in both.","triggerScenarios":"POST `/api/external-api/v1/integrations/{provider}/oauth/authorize` with an unknown or misspelled provider slug (e.g. `githb`, `google-drive` vs `google_drive`), or a provider whose block (which registers its OAuth handler) failed to load.","commonSituations":"Slug spelling/casing mistakes; provider exists for API-key auth but has no OAuth handler; SDK-contributed provider whose block import failed at runtime (the helper logs 'Failed to load blocks' and proceeds with a partial registry); provider removed in a newer platform version while an old client keeps calling it.","solutions":["GET `/api/external-api/v1/integrations/providers` and use the exact provider id/slug it returns for the authorize call.","Check provider name spelling and separator convention (usually snake_case).","If the provider should come from an SDK block, inspect backend startup logs for block-load failures that would leave it out of `HANDLERS_BY_NAME`.","Upgrade/downgrade client and platform to matching versions if the provider set changed between releases."],"exampleFix":"# before\nPOST /integrations/github-oauth/oauth/authorize  # 404 Provider not found\n\n# after\nGET /integrations/providers  -> [{\"id\": \"github\", \"oauth\": true}, ...]\nPOST /integrations/github/oauth/authorize","handlingStrategy":"validation","validationCode":"providers = client.get(\"/integrations/providers\").json()\nknown = {p[\"id\"] for p in providers}\nif provider not in known:\n    raise ValueError(f\"unknown provider {provider!r}; choose from {sorted(known)}\")","typeGuard":null,"tryCatchPattern":"try:\n    client.post(f\"/integrations/{provider}/oauth/authorize\", json=payload)\nexcept HTTPError as e:\n    if e.response.status_code == 404:\n        # refresh provider list and surface actionable error\n        raise UnknownProvider(provider) from e\n    raise","preventionTips":["Fetch and cache the provider list per session instead of hardcoding slugs.","Treat provider slugs as an API contract: pin client and platform versions together.","Distinguish 404 'provider not found' from 501 'provider not configured' in client handling."],"tags":["oauth","provider","not-found","external-api"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}