AdguardTeam/AdGuardHome · error

invalid bind_host value: %s

Error message

invalid bind_host value: %s

What it means

During migration to schema 23, the top-level bind_host value is not a parseable IP address (netip.ParseAddr fails). The migration combines bind_host and bind_port into a unified bind address, so bind_host must be a literal IP.

Source

Thrown at internal/configmigrate/v23.go:37

//	# …
//
//	# AFTER:
//	'schema_version': 23
//	'http':
//	  'address': '1.2.3.4:8080'
//	  'session_ttl': '720h'
//	# …
func (m *Migrator) migrateTo23(_ context.Context, diskConf yobj) (err error) {
	diskConf["schema_version"] = 23

	bindHost, ok, err := fieldVal[string](diskConf, "bind_host")
	if !ok {
		return err
	}

	bindHostAddr, err := netip.ParseAddr(bindHost)
	if err != nil {
		return fmt.Errorf("invalid bind_host value: %s", bindHost)
	}

	bindPort, _, err := fieldVal[int](diskConf, "bind_port")
	if err != nil {
		return err
	}

	sessionTTL, _, err := fieldVal[int](diskConf, "web_session_ttl")
	if err != nil {
		return err
	}

	diskConf["http"] = yobj{
		"address":     netip.AddrPortFrom(bindHostAddr, uint16(bindPort)).String(),
		"session_ttl": timeutil.Duration(time.Duration(sessionTTL) * time.Hour).String(),
	}

	delete(diskConf, "bind_host")

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Change bind_host to a literal IP, e.g. 0.0.0.0, 127.0.0.1, or ::
  2. Remove the field entirely if the default binding is acceptable
  3. Retry the migration

Example fix

# before
bind_host: localhost

# after
bind_host: 127.0.0.1
Defensive patterns

Strategy: validation

Validate before calling

if _, err := netip.ParseAddr(bindHost); err != nil { /* replace hostnames like localhost with 0.0.0.0/127.0.0.1 before migrating */ }

Type guard

func isLiteralIP(s string) bool { _, err := netip.ParseAddr(s); return err == nil }

Try / catch

if err != nil && strings.Contains(err.Error(), "invalid bind_host value") { /* set bind_host to 0.0.0.0 and re-migrate */ }

Prevention

When it happens

Trigger: Migrating a config where bind_host is a hostname like "0.0.0.0" is fine, but "localhost", an empty-but-present value, or a malformed address like "192.168.1" triggers this error.

Common situations: Users setting bind_host: localhost (a hostname, not an IP) or leaving stray characters after editing; configs from tools that write hostnames into bind_host.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/7dcd3507e4dcda01. Report an issue: GitHub.