{"record":{"id":"b7df6add4b8f42b3","repo":"air-verse/air","slug":"unsupported-color-mode-s-expected-always-auto","errorCode":null,"errorMessage":"unsupported color mode: %s. Expected always, auto, or never","messagePattern":"unsupported color mode: (.+?)\\. Expected always, auto, or never","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"runner/config.go","lineNumber":722,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"failed to compile regex %q: %w\", expr, err)\n\t\t\t}\n\t\t\tregexCompiled[idx] = re\n\t\t}\n\t\tc.Build.regexCompiled = regexCompiled\n\t}\n\n\tc.Build.ExcludeDir = ed\n\n\t// Set colorful output, see https://github.com/fatih/color#disableenable-color\n\tswitch c.Color.Mode {\n\tcase \"always\":\n\t\tcolor.NoColor = false\n\tcase \"never\":\n\t\tcolor.NoColor = true\n\tcase \"auto\", \"\":\n\t\tbreak\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported color mode: %s. Expected always, auto, or never\", c.Color.Mode)\n\t}\n\n\tif len(c.Build.FullBin) > 0 {\n\t\tc.Build.Bin = c.Build.FullBin\n\t\treturn err\n\t}\n\t// Fix windows CMD processor\n\t// CMD will not recognize relative path like ./tmp/server\n\tc.Build.Bin, err = filepath.Abs(c.Build.Bin)\n\n\treturn err\n}\n\n// adjustDefaultsForTmpDir updates Build.Cmd, Build.Bin, and Build.ExcludeDir\n// when they still hold their default values but TmpDir has been changed.\nfunc (c *Config) adjustDefaultsForTmpDir() {\n\tc.adjustDefaultsForTmpDirWithOS(runtime.GOOS)\n}","sourceCodeStart":704,"sourceCodeEnd":740,"githubUrl":"https://github.com/air-verse/air/blob/71ea1dee05248122ed22b5870c7fb20a90d80ddd/runner/config.go#L704-L740","documentation":"Air validates the `color.mode` config value and only accepts \"always\", \"never\", \"auto\", or empty. Any other string fails config validation and air exits with this message.","triggerScenarios":"Setting `[color] mode` in .air.toml to a misspelled or unsupported value such as \"true\", \"yes\", \"on\", or \"Always\" (case-sensitive check) — the switch statement falls through to the default branch.","commonSituations":"Copying a config from another tool that uses on/off/force vocabulary; typo like \"alwyas\"; wrong casing since the comparison is case-sensitive.","solutions":["Change color mode in .air.toml to one of: \"always\", \"auto\", or \"never\"","Use \"auto\" (or remove the key) to let air detect TTY support","Check casing — the value must be lowercase"],"exampleFix":"// before (.air.toml)\n[color]\nmode = \"on\"\n// after\n[color]\nmode = \"auto\"","handlingStrategy":"validation","validationCode":"// pre-validate color mode\nswitch colorMode {\ncase \"\", \"auto\", \"always\", \"never\":\n\t// ok\ndefault:\n\treturn fmt.Errorf(\"invalid color mode %q; use always|auto|never\", colorMode)\n}","typeGuard":null,"tryCatchPattern":"if err := loadConfig(); err != nil && strings.Contains(err.Error(), \"unsupported color mode\") {\n\tlog.Fatal(\"fix [color] mode in .air.toml: always, auto, or never\")\n}","preventionTips":["Only use documented enum values: always, auto, never","Values are case-sensitive and lowercase","Omit [color] entirely to get the auto default","Copy config snippets from air_example.toml, not other tools"],"tags":["config","color","validation"],"backgroundTag":"invalid-config-enum-value","analyzedSha":"71ea1dee05248122ed22b5870c7fb20a90d80ddd","analyzedAt":"2026-08-31T20:27:54.676Z","schemaVersion":2},"datasetVersion":"2026-09-01T03:17:15.561Z"}