{"record":{"id":"ad8bccf636ec45cd","repo":"cloudflare/cloudflared","slug":"expected-boolean-found-t-for-s","errorCode":null,"errorMessage":"expected boolean found %T for %s","messagePattern":"expected boolean found %T for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/configuration.go","lineNumber":370,"sourceCode":"\t\t}\n\t\tif v, ok := raw.([]int); ok {\n\t\t\treturn v, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"expected int slice found %T for %s\", raw, name)\n\t}\n\treturn nil, nil\n}\n\nfunc (c *configFileSettings) Generic(name string) (cli.Generic, error) {\n\treturn nil, errors.New(\"option type Generic not supported\")\n}\n\nfunc (c *configFileSettings) Bool(name string) (bool, error) {\n\tif raw, ok := c.Settings[name]; ok {\n\t\tif v, ok := raw.(bool); ok {\n\t\t\treturn v, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"expected boolean found %T for %s\", raw, name)\n\t}\n\treturn false, nil\n}\n\nvar configuration configFileSettings\n\nfunc GetConfiguration() *Configuration {\n\treturn &configuration.Configuration\n}\n\n// ReadConfigFile returns InputSourceContext initialized from the configuration file.\n// On repeat calls returns with the same file, returns without reading the file again; however,\n// if value of \"config\" flag changes, will read the new config file\nfunc ReadConfigFile(c *cli.Context, log *zerolog.Logger) (settings *configFileSettings, warnings string, err error) {\n\tconfigFile := c.String(\"config\")\n\tif configuration.Source() == configFile || configFile == \"\" {\n\t\tif configuration.Source() == \"\" {\n\t\t\treturn nil, \"\", ErrNoConfigFile","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/config/configuration.go#L352-L388","documentation":"configFileSettings.Bool reads a named setting from the YAML config file and expects a Go bool (YAML true/false). If the key exists but holds any other type (string \"true\", int 1, etc.), cloudflared returns `expected boolean found %T` naming the actual type. Boolean flags set in the config file must be real YAML booleans, not quoted strings.","triggerScenarios":"A boolean flag (e.g. `hello-world: true`, `url: ...` style toggles) is present in c.Settings but its value is a string like \"true\", a number, or a nested map, when the CLI bool accessor is called during config resolution.","commonSituations":"Writing `flag: \"true\"` (quoted) in config.yml, using `flag: yes` with a YAML parser configured oddly, or copying CLI-style `--flag=true` text into the config file.","solutions":["Edit the config file so the value is an unquoted YAML boolean: `flag: true`","Remove quotes around true/false values","If the value came from environment substitution, ensure the substituted text is bare true/false","Re-run cloudflared with the fixed config file"],"exampleFix":"# before (config.yml)\nhello-world: \"true\"\n# after\nhello-world: true","handlingStrategy":"validation","validationCode":"raw, ok := cfg[\"boolFlag\"]\nif ok { if _, isBool := raw.(bool); !isBool { return fmt.Errorf(\"boolFlag must be bare true/false, got %T\", raw) } }","typeGuard":"func isYAMLBool(v interface{}) bool { _, ok := v.(bool); return ok }","tryCatchPattern":null,"preventionTips":["Use bare true/false (no quotes) for boolean flags in config.yml","Avoid injecting boolean values via env substitution that could quote them","Don't copy CLI --flag=true syntax into YAML"],"tags":["config","type-mismatch","yaml","boolean"],"backgroundTag":"config-type-mismatch","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}