infiniflow/ragflow · error · ValueError

Unsupported type: {channel_type}

Error message

Unsupported type: {channel_type}

What it means

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.

Source

Thrown at api/apps/auth/__init__.py:34

from .oauth import OAuthClient
from .oidc import OIDCClient
from .github import GithubOAuthClient


CLIENT_TYPES = {"oauth2": OAuthClient, "oidc": OIDCClient, "github": GithubOAuthClient}


def get_auth_client(config) -> OAuthClient:
    channel_type = str(config.get("type", "")).lower()
    if channel_type == "":
        if config.get("issuer"):
            channel_type = "oidc"
        else:
            channel_type = "oauth2"
    client_class = CLIENT_TYPES.get(channel_type)
    if not client_class:
        raise ValueError(f"Unsupported type: {channel_type}")

    return client_class(config)

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set type to one of 'oauth2', 'oidc', or 'github' (case-insensitive, no surrounding whitespace).
  2. For a standards-based provider, prefer type 'oidc' with an 'issuer' URL so discovery fills in the endpoints.
  3. For plain OAuth2 without discovery, use type 'oauth2' and supply authorization/token/userinfo URLs explicitly.
  4. Check the stored config for stray spaces or a non-string type value.

Example fix

// before
{"type": "google", "client_id": "..."}

// after
{"type": "oidc", "issuer": "https://accounts.google.com", "client_id": "..."}
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED = {"oauth2", "oidc", "github"}

type_ = str(config.get("type", "")).strip().lower()
if not type_:
    type_ = "oidc" if config.get("issuer") else "oauth2"
if type_ not in SUPPORTED:
    raise ValueError(f"type must be one of {sorted(SUPPORTED)}, got {type_!r}")

Type guard

def is_supported_auth_type(cfg: dict) -> bool:
    t = str(cfg.get("type", "")).strip().lower()
    if not t:
        t = "oidc" if cfg.get("issuer") else "oauth2"
    return t in {"oauth2", "oidc", "github"}

Try / catch

try:
    client = get_auth_client(config)
except ValueError as e:
    if "Unsupported type" in str(e):
        raise ConfigError(f"Fix provider config: {e}") from e
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/e2495a2e37f399ee. Report an issue: GitHub.