caddyserver/caddy · error

unexpected type from 'default_bind' global options: %T

Error message

unexpected type from 'default_bind' global options: %T

What it means

Error "unexpected type from 'default_bind' global options: %T" thrown in caddyserver/caddy.

Source

Thrown at caddyconfig/httpcaddyfile/httptype.go:431

				existingOpts = []ConfigValue{}
			}
			logOpts, ok := val.([]ConfigValue)
			if !ok {
				return nil, fmt.Errorf("unexpected type from 'log' global options: %T", val)
			}
			options[opt] = append(existingOpts, logOpts...)
			continue
		}
		// Also fold multiple "default_bind" options together into an
		// array so that server blocks can have multiple binds by default.
		if opt == "default_bind" {
			existingOpts, ok := options[opt].([]ConfigValue)
			if !ok {
				existingOpts = []ConfigValue{}
			}
			defaultBindOpts, ok := val.([]ConfigValue)
			if !ok {
				return nil, fmt.Errorf("unexpected type from 'default_bind' global options: %T", val)
			}
			options[opt] = append(existingOpts, defaultBindOpts...)
			continue
		}

		options[opt] = val
	}

	// If we got "servers" options, we'll sort them by their listener address
	if serverOpts, ok := options["servers"].([]serverOptions); ok {
		sort.Slice(serverOpts, func(i, j int) bool {
			return len(serverOpts[i].ListenerAddress) > len(serverOpts[j].ListenerAddress)
		})

		// Reject the config if there are duplicate listener address
		seen := make(map[string]bool)
		for _, entry := range serverOpts {
			if _, alreadySeen := seen[entry.ListenerAddress]; alreadySeen {

View on GitHub (pinned to 50e54ee279)

Solutions

  1. This is an internal type mismatch from the 'default_bind' global option; ensure custom option parsers return the expected type.

When it happens

Trigger: Thrown at caddyconfig/httpcaddyfile/httptype.go:431 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/5d0e4f39f561d589. Report an issue: GitHub.