{"record":{"id":"a7cb4ee7632376ca","repo":"coder/code-server","slug":"unsupported-auth-type-req-args-auth","errorCode":null,"errorMessage":"Unsupported auth type ${req.args.auth}","messagePattern":"Unsupported auth type (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/node/http.ts","lineNumber":136,"sourceCode":"  switch (req.args.auth) {\n    case AuthType.None: {\n      return true\n    }\n    case AuthType.Password: {\n      // The password is stored in the cookie after being hashed.\n      const hashedPasswordFromArgs = req.args[\"hashed-password\"]\n      const passwordMethod = getPasswordMethod(hashedPasswordFromArgs)\n      const isCookieValidArgs: IsCookieValidArgs = {\n        passwordMethod,\n        cookieKey: sanitizeString(req.cookies[req.cookieSessionName]),\n        passwordFromArgs: req.args.password || \"\",\n        hashedPasswordFromArgs: req.args[\"hashed-password\"],\n      }\n\n      return await isCookieValid(isCookieValidArgs)\n    }\n    default: {\n      throw new Error(`Unsupported auth type ${req.args.auth}`)\n    }\n  }\n}\n\n/**\n * Get the relative path that will get us to the root of the page. For each\n * slash we need to go up a directory.  Will not have a trailing slash.\n *\n * For example:\n *\n * / => .\n * /foo => .\n * /foo/ => ./..\n * /foo/bar => ./..\n * /foo/bar/ => ./../..\n *\n * All paths must be relative in order to work behind a reverse proxy since we\n * we do not know the base path.  Anything that needs to be absolute (for","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/coder/code-server/blob/51f90a376b42e217b38937410fe2855e0c1db87e/src/node/http.ts#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before (config.yaml)\nauth: None\n\n# after (config.yaml)\nauth: none","handlingStrategy":"validation","validationCode":"import { AuthType } from \"../../common/http\"\nconst SUPPORTED = new Set<AuthType>([AuthType.None, AuthType.Password])\nfunction validateAuthType(auth: unknown): void {\n  if (typeof auth !== \"string\" || !SUPPORTED.has(auth as AuthType)) {\n    throw new Error(`Unsupported auth type ${String(auth)}; use 'none' or 'password'`)\n  }\n}","typeGuard":"function isSupportedAuthType(v: unknown): v is AuthType {\n  return v === AuthType.None || v === AuthType.Password\n}","tryCatchPattern":"if (!isSupportedAuthType(args.auth)) {\n  throw new Error(`Unsupported auth type ${String(args.auth)}`)\n}","preventionTips":["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"],"tags":["auth","config","validation","enum","startup"],"backgroundTag":null,"analyzedSha":"51f90a376b42e217b38937410fe2855e0c1db87e","analyzedAt":"2026-08-12T11:27:34.273Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}