cloudflare/cloudflared · error

option type Generic not supported

Error message

option type Generic not supported

What it means

configFileSettings is the configuration-file adapter that satisfies the cli flag-source interface used to feed file-based settings into urfave/cli. Generic is the accessor for urfave/cli's generic flag type, which the file-settings backend does not implement, so it always returns this error. It exists only to satisfy the interface.

Solutions

  1. Remove the offending option from the config file, or express its value with a supported type (string, bool, int, duration, string slice)
  2. Do not call Generic on config-file settings; read such values directly from the settings map instead
  3. Check which flag maps to a Generic type in the urfave/cli command definition and avoid setting it via the config file

Example fix

# before (config.yml)
some-generic-option:
  key: value
# after
# remove the option or use a supported scalar/list type
some-string-option: value
Defensive patterns

Strategy: type-guard

Validate before calling

if _, isGeneric := flagValue.(cli.Generic); isGeneric {
    return errors.New("generic flags cannot be set from the config file")
}

Type guard

func isUnsupportedGenericAccessor(err error) bool {
    return err != nil && strings.Contains(err.Error(), "option type Generic not supported")
}

Try / catch

val, err := settings.Generic(name)
if err != nil && strings.Contains(err.Error(), "Generic not supported") {
    // fall back to a supported accessor: settings.String(name), etc.
}

Prevention

When it happens

Trigger: A configuration file defines a flag whose type resolves to the cli.Generic interface, and code calls configFileSettings.Generic(name) to read it (or the flag-source machinery routes a lookup to Generic).

Common situations: A user puts an option in config.yml whose corresponding CLI flag is a Generic/placeholder type; custom code built on cloudflared's config package reads a settings map through the cli flag-source interface.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at config/configuration.go:362

			for i, v := range slice {
				str, ok := v.(int)
				if !ok {
					return nil, fmt.Errorf("expected int, found %T for %v ", v, v)
				}
				intSlice[i] = str
			}
			return intSlice, nil
		}
		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
}

View on GitHub (pinned to 2253eeeb25)