cloudflare/cloudflared · error

expected boolean found %T for

Error message

expected boolean found %T for %s

What it means

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.

Solutions

  1. Edit the config file so the value is an unquoted YAML boolean: `flag: true`
  2. Remove quotes around true/false values
  3. If the value came from environment substitution, ensure the substituted text is bare true/false
  4. Re-run cloudflared with the fixed config file

Example fix

# before (config.yml)
hello-world: "true"
# after
hello-world: true
Defensive patterns

Strategy: validation

Validate before calling

raw, ok := cfg["boolFlag"]
if ok { if _, isBool := raw.(bool); !isBool { return fmt.Errorf("boolFlag must be bare true/false, got %T", raw) } }

Type guard

func isYAMLBool(v interface{}) bool { _, ok := v.(bool); return ok }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06). Data as JSON: /api/errors/ad8bccf636ec45cd. Report an issue: GitHub.

Appendix: source

Thrown at config/configuration.go:370

		}
		if v, ok := raw.([]int); ok {
			return v, nil
		}
		return nil, fmt.Errorf("expected int slice found %T for %s", raw, name)
	}
	return nil, nil
}

func (c *configFileSettings) Generic(name string) (cli.Generic, error) {
	return nil, errors.New("option type Generic not supported")
}

func (c *configFileSettings) Bool(name string) (bool, error) {
	if raw, ok := c.Settings[name]; ok {
		if v, ok := raw.(bool); ok {
			return v, nil
		}
		return false, fmt.Errorf("expected boolean found %T for %s", raw, name)
	}
	return false, nil
}

var configuration configFileSettings

func GetConfiguration() *Configuration {
	return &configuration.Configuration
}

// ReadConfigFile returns InputSourceContext initialized from the configuration file.
// On repeat calls returns with the same file, returns without reading the file again; however,
// if value of "config" flag changes, will read the new config file
func ReadConfigFile(c *cli.Context, log *zerolog.Logger) (settings *configFileSettings, warnings string, err error) {
	configFile := c.String("config")
	if configuration.Source() == configFile || configFile == "" {
		if configuration.Source() == "" {
			return nil, "", ErrNoConfigFile

View on GitHub (pinned to 2253eeeb25)