infiniflow/ragflow · error · Exception

Unsupported auth_type: {auth_type}

Error message

Unsupported auth_type: {auth_type}

What it means

In validate_webhook_security, after handling 'none', 'token', 'basic', and 'jwt', any other auth_type value falls through to Exception(f"Unsupported auth_type: {auth_type}") (agent_api.py:1926). The bad value is echoed in the message, making typos easy to spot.

Source

Thrown at api/apps/restful_apis/agent_api.py:1926

                logging.warning(
                    "Webhook denied: anonymous access missing explicit opt-in agent_id=%s method=%s",
                    agent_id,
                    request.method,
                )
                raise Exception("Anonymous webhook access requires allow_anonymous to be true")
            return

        if auth_type == "token":
            _validate_token_auth(security_cfg)

        elif auth_type == "basic":
            _validate_basic_auth(security_cfg)

        elif auth_type == "jwt":
            _validate_jwt_auth(security_cfg)

        else:
            raise Exception(f"Unsupported auth_type: {auth_type}")

    async def _validate_max_body_size(security_cfg):
        """Check request size does not exceed max_body_size."""
        max_size = security_cfg.get("max_body_size")
        if not max_size:
            max_size = "10MB"

        # Convert "10MB" → bytes
        units = {"kb": 1024, "mb": 1024**2}
        size_str = max_size.lower()

        for suffix, factor in units.items():
            if size_str.endswith(suffix):
                limit = int(size_str.replace(suffix, "")) * factor
                break
        else:
            raise Exception("Invalid max_body_size format")
        MAX_LIMIT = 10 * 1024 * 1024  # 10MB

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set auth_type to exactly one of: 'none', 'token', 'basic', 'jwt' (lowercase, no whitespace).
  2. If you wanted no authentication, remember 'none' additionally requires allow_anonymous: true.
  3. Fix the value in the agent's webhook/security config and re-publish.
  4. Validate the security JSON before applying it (see the guard snippet) so typos fail fast at config time, not request time.

Example fix

// before
"security": {"auth_type": "bearer", "token": "abc"}

// after
"security": {"auth_type": "token", "token": "abc"}
Defensive patterns

Strategy: type-guard

Validate before calling

VALID_AUTH_TYPES = {"none", "token", "basic", "jwt"}
auth_type = str(security_cfg.get("auth_type", "none")).strip().lower()
if auth_type not in VALID_AUTH_TYPES:
    raise ValueError(f"auth_type must be one of {sorted(VALID_AUTH_TYPES)}, got {auth_type!r}")

Type guard

def is_supported_webhook_auth_type(sec: dict) -> bool:
    return str(sec.get("auth_type", "none")).strip().lower() in {"none", "token", "basic", "jwt"}

Try / catch

try:
    resp = await invoke_webhook(session, url, payload)
except WebhookRejected as e:
    if "Unsupported auth_type" in str(e):
        raise ConfigError(f"Fix webhook security config: {e}") from e
    raise

Prevention

When it happens

Trigger: security config auth_type set to values like 'apiKey', 'bearer', 'oauth', 'Token' (capitalized), 'none ' (trailing space), or null-ish strings like 'undefined'; hand-edited webhook security JSON.

Common situations: Copy-pasting auth type names from other systems; case or whitespace slips; editing agent JSON directly instead of through the UI.

Related errors


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