{"record":{"id":"015bfd6204155973","repo":"AdguardTeam/AdGuardHome","slug":"dns-bind-hosts-at-index-d-is-not-a-valid-ip-addre","errorCode":null,"errorMessage":"dns.bind_hosts at index %d is not a valid ip address","messagePattern":"dns\\.bind_hosts at index (.+?) is not a valid ip address","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/home/config.go","lineNumber":642,"sourceCode":"}\n\n// validateBindHosts returns error if any of binding hosts from configuration is\n// not a valid IP address.\nfunc validateBindHosts(\n\tctx context.Context,\n\tl *slog.Logger,\n\tconf *configuration,\n\tfileData []byte,\n) (err error) {\n\tif !conf.HTTPConfig.Address.IsValid() {\n\t\treturn errors.Error(\"http.address is not a valid ip address\")\n\t}\n\n\tfor i, addr := range conf.DNS.BindHosts {\n\t\tif !addr.IsValid() {\n\t\t\tlogIPHint(ctx, l, fileData)\n\n\t\t\treturn fmt.Errorf(\"dns.bind_hosts at index %d is not a valid ip address\", i)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// parseConfig loads configuration from the YAML file, upgrading it if\n// necessary.  l must not be nil.\nfunc parseConfig(ctx context.Context, l *slog.Logger, workDir, confPath string) (err error) {\n\t// Do the upgrade if necessary.\n\tconfig.fileData, err = readConfigFile(ctx, l, workDir, confPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmigrator := configmigrate.New(&configmigrate.Config{\n\t\tLogger:     l.With(slogutil.KeyPrefix, \"config_migrator\"),\n\t\tWorkingDir: workDir,","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/home/config.go#L624-L660","documentation":"Config validation found an entry in dns.bind_hosts that is not a valid IP address (invalid netip.Addr). The index of the offending entry is included.","triggerScenarios":"YAML config containing bind_hosts entries that are empty strings, hostnames, or malformed IPs (e.g. \"192.168.1\", \"localhost\").","commonSituations":"Hand-edited AdGuardHome.yaml, using a hostname or CIDR where a bare IP is required, trailing spaces/quotes mistakes, migration from older config formats.","solutions":["Open AdGuardHome.yaml and fix/remove the dns.bind_hosts entry at the reported index — use bare IP literals like 0.0.0.0 or 127.0.0.1","Replace hostnames with the IPs they resolve to","Validate the YAML with a linter before restarting"],"exampleFix":"# before\ndns:\n  bind_hosts:\n    - localhost\n# after\ndns:\n  bind_hosts:\n    - 127.0.0.1","handlingStrategy":"validation","validationCode":"// Validate bind hosts before deploy\nfor _, h := range cfg.DNS.BindHosts {\n    if netip.MustParseAddr(h).String() != h { return errors.New(\"invalid ip\") }\n}","typeGuard":"func validBindHosts(hosts []string) bool {\n    for _, h := range hosts {\n        if _, err := netip.ParseAddr(h); err != nil { return false }\n    }\n    return true\n}","tryCatchPattern":null,"preventionTips":["Use IP literals only in dns.bind_hosts","Lint AdGuardHome.yaml in CI when managing configs as code"],"tags":["config","dns","yaml","validation","startup"],"backgroundTag":"config-validation-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}