{"record":{"id":"e2495a2e37f399ee","repo":"infiniflow/ragflow","slug":"unsupported-type-channel-type","errorCode":null,"errorMessage":"Unsupported type: {channel_type}","messagePattern":"Unsupported type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"api/apps/auth/__init__.py","lineNumber":34,"sourceCode":"\nfrom .oauth import OAuthClient\nfrom .oidc import OIDCClient\nfrom .github import GithubOAuthClient\n\n\nCLIENT_TYPES = {\"oauth2\": OAuthClient, \"oidc\": OIDCClient, \"github\": GithubOAuthClient}\n\n\ndef get_auth_client(config) -> OAuthClient:\n    channel_type = str(config.get(\"type\", \"\")).lower()\n    if channel_type == \"\":\n        if config.get(\"issuer\"):\n            channel_type = \"oidc\"\n        else:\n            channel_type = \"oauth2\"\n    client_class = CLIENT_TYPES.get(channel_type)\n    if not client_class:\n        raise ValueError(f\"Unsupported type: {channel_type}\")\n\n    return client_class(config)\n","sourceCodeStart":16,"sourceCodeEnd":37,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/auth/__init__.py#L16-L37","documentation":"get_auth_client (api/apps/auth/__init__.py:27-34) maps the lowercased config['type'] to a client class via CLIENT_TYPES = {'oauth2', 'oidc', 'github'}. An empty/missing type is inferred: 'oidc' if config['issuer'] exists, else 'oauth2'. Any other value raises ValueError('Unsupported type: {channel_type}'), echoing the bad value.","triggerScenarios":"Auth configuration JSON with type set to 'saml', 'azure', 'google', 'gitlab', 'OAuth2' case variants are fine (it lowercases) but 'oauth-2' or 'github_oauth' are not; a numeric or object value stringifies into something unmapped.","commonSituations":"Hand-written OAuth provider config in system settings; copying config snippets from docs of other products expecting provider-specific type names; trailing whitespace in the type string (' github' fails since only case is normalized).","solutions":["Set type to one of 'oauth2', 'oidc', or 'github' (case-insensitive, no surrounding whitespace).","For a standards-based provider, prefer type 'oidc' with an 'issuer' URL so discovery fills in the endpoints.","For plain OAuth2 without discovery, use type 'oauth2' and supply authorization/token/userinfo URLs explicitly.","Check the stored config for stray spaces or a non-string type value."],"exampleFix":"// before\n{\"type\": \"google\", \"client_id\": \"...\"}\n\n// after\n{\"type\": \"oidc\", \"issuer\": \"https://accounts.google.com\", \"client_id\": \"...\"}","handlingStrategy":"type-guard","validationCode":"SUPPORTED = {\"oauth2\", \"oidc\", \"github\"}\n\ntype_ = str(config.get(\"type\", \"\")).strip().lower()\nif not type_:\n    type_ = \"oidc\" if config.get(\"issuer\") else \"oauth2\"\nif type_ not in SUPPORTED:\n    raise ValueError(f\"type must be one of {sorted(SUPPORTED)}, got {type_!r}\")","typeGuard":"def is_supported_auth_type(cfg: dict) -> bool:\n    t = str(cfg.get(\"type\", \"\")).strip().lower()\n    if not t:\n        t = \"oidc\" if cfg.get(\"issuer\") else \"oauth2\"\n    return t in {\"oauth2\", \"oidc\", \"github\"}","tryCatchPattern":"try:\n    client = get_auth_client(config)\nexcept ValueError as e:\n    if \"Unsupported type\" in str(e):\n        raise ConfigError(f\"Fix provider config: {e}\") from e\n    raise","preventionTips":["Validate auth provider configs against a schema before saving them to system settings.","Trim whitespace and lowercase the type value during normalization.","Prefer issuer-based OIDC config over provider-specific type names."],"tags":["auth","oauth","configuration","validation"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}