{"record":{"id":"7dcd3507e4dcda01","repo":"AdguardTeam/AdGuardHome","slug":"invalid-bind-host-value-s","errorCode":null,"errorMessage":"invalid bind_host value: %s","messagePattern":"invalid bind_host value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configmigrate/v23.go","lineNumber":37,"sourceCode":"//\t# …\n//\n//\t# AFTER:\n//\t'schema_version': 23\n//\t'http':\n//\t  'address': '1.2.3.4:8080'\n//\t  'session_ttl': '720h'\n//\t# …\nfunc (m *Migrator) migrateTo23(_ context.Context, diskConf yobj) (err error) {\n\tdiskConf[\"schema_version\"] = 23\n\n\tbindHost, ok, err := fieldVal[string](diskConf, \"bind_host\")\n\tif !ok {\n\t\treturn err\n\t}\n\n\tbindHostAddr, err := netip.ParseAddr(bindHost)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid bind_host value: %s\", bindHost)\n\t}\n\n\tbindPort, _, err := fieldVal[int](diskConf, \"bind_port\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsessionTTL, _, err := fieldVal[int](diskConf, \"web_session_ttl\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdiskConf[\"http\"] = yobj{\n\t\t\"address\":     netip.AddrPortFrom(bindHostAddr, uint16(bindPort)).String(),\n\t\t\"session_ttl\": timeutil.Duration(time.Duration(sessionTTL) * time.Hour).String(),\n\t}\n\n\tdelete(diskConf, \"bind_host\")","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/configmigrate/v23.go#L19-L55","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change bind_host to a literal IP, e.g. 0.0.0.0, 127.0.0.1, or ::","Remove the field entirely if the default binding is acceptable","Retry the migration"],"exampleFix":"# before\nbind_host: localhost\n\n# after\nbind_host: 127.0.0.1","handlingStrategy":"validation","validationCode":"if _, err := netip.ParseAddr(bindHost); err != nil { /* replace hostnames like localhost with 0.0.0.0/127.0.0.1 before migrating */ }","typeGuard":"func isLiteralIP(s string) bool { _, err := netip.ParseAddr(s); return err == nil }","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid bind_host value\") { /* set bind_host to 0.0.0.0 and re-migrate */ }","preventionTips":["bind_host accepts IPs only; use 0.0.0.0 for all interfaces, not a hostname"],"tags":["config","migration","bind","network","validation"],"backgroundTag":"invalid-ip-address","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}