coder/code-server · error · Error
Unsupported auth type ${req.args.auth}
Error message
Unsupported auth type ${req.args.auth} What it means
The authenticated() switch (http.ts:136) handles only AuthType.None and AuthType.Password. Any other value in req.args.auth falls through to the default branch and throws `Unsupported auth type <value>`. This is a defensive guard against misconfiguration or a corrupted args object.
Source
Thrown at src/node/http.ts:136
switch (req.args.auth) {
case AuthType.None: {
return true
}
case AuthType.Password: {
// The password is stored in the cookie after being hashed.
const hashedPasswordFromArgs = req.args["hashed-password"]
const passwordMethod = getPasswordMethod(hashedPasswordFromArgs)
const isCookieValidArgs: IsCookieValidArgs = {
passwordMethod,
cookieKey: sanitizeString(req.cookies[req.cookieSessionName]),
passwordFromArgs: req.args.password || "",
hashedPasswordFromArgs: req.args["hashed-password"],
}
return await isCookieValid(isCookieValidArgs)
}
default: {
throw new Error(`Unsupported auth type ${req.args.auth}`)
}
}
}
/**
* Get the relative path that will get us to the root of the page. For each
* slash we need to go up a directory. Will not have a trailing slash.
*
* For example:
*
* / => .
* /foo => .
* /foo/ => ./..
* /foo/bar => ./..
* /foo/bar/ => ./../..
*
* All paths must be relative in order to work behind a reverse proxy since we
* we do not know the base path. Anything that needs to be absolute (forView on GitHub (pinned to 51f90a376b)
Solutions
- Set auth to one of the supported values: `none` or `password`
- Check for trailing whitespace/quotes around the value in config.yaml
- If using the API/args directly, use the AuthType enum constant rather than a raw string
Example fix
# before (config.yaml) auth: None # after (config.yaml) auth: none
Defensive patterns
Strategy: validation
Validate before calling
import { AuthType } from "../../common/http"
const SUPPORTED = new Set<AuthType>([AuthType.None, AuthType.Password])
function validateAuthType(auth: unknown): void {
if (typeof auth !== "string" || !SUPPORTED.has(auth as AuthType)) {
throw new Error(`Unsupported auth type ${String(auth)}; use 'none' or 'password'`)
}
} Type guard
function isSupportedAuthType(v: unknown): v is AuthType {
return v === AuthType.None || v === AuthType.Password
} Try / catch
if (!isSupportedAuthType(args.auth)) {
throw new Error(`Unsupported auth type ${String(args.auth)}`)
} Prevention
- Use the AuthType enum, not raw strings, when setting args programmatically
- Trim/normalize auth values read from config files
- Lint config.yaml against the supported auth enum in CI
When it happens
Trigger: Configuring `auth: none` (lowercase) or `auth: password ` (trailing space) so the string does not match the enum; setting auth to an invented value like `oauth`; programmatic args with an untrimmed/unknown auth string.
Common situations: Typos in config.yaml; case mismatches (`None` vs `none`); copying a config snippet from a different code-server major version that supported more auth types.
Related errors
- invalid config: ${config}
- Please pass in a password via the config file or environment
- --idle-timeout-seconds must be greater than 60 seconds.
- Unauthorized
- Custom strings file not found: ${filePath}\nPlease ensure th
AI-assisted analysis of coder/code-server@51f90a376b (2026-08-12).
Data as JSON: /api/errors/a7cb4ee7632376ca.
Report an issue: GitHub.