{"record":{"id":"8fdcc5baaac9926a","repo":"AdguardTeam/AdGuardHome","slug":"neither-dhcpv4-nor-dhcpv6-srv-is-configured","errorCode":null,"errorMessage":"neither dhcpv4 nor dhcpv6 srv is configured","messagePattern":"neither dhcpv4 nor dhcpv6 srv is configured","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/dhcpd/dhcpd.go","lineNumber":140,"sourceCode":"\t\t\tdbFilePath: filepath.Join(conf.DataDir, dataFilename),\n\t\t},\n\t}\n\n\t// TODO(e.burkov):  Don't register handlers, see TODO on\n\t// [aghhttp.RegisterFunc].\n\ts.registerHandlers()\n\n\tv4Enabled, v6Enabled, err := s.setServers(ctx, conf)\n\tif err != nil {\n\t\t// Don't wrap the error, because it's informative enough as is.\n\t\treturn nil, err\n\t}\n\n\ts.conf.Conf4 = conf.Conf4\n\ts.conf.Conf6 = conf.Conf6\n\n\tif s.conf.Enabled && !v4Enabled && !v6Enabled {\n\t\treturn nil, fmt.Errorf(\"neither dhcpv4 nor dhcpv6 srv is configured\")\n\t}\n\n\t// Migrate leases db if needed.\n\terr = migrateDB(conf)\n\tif err != nil {\n\t\t// Don't wrap the error since it's informative enough as is.\n\t\treturn nil, err\n\t}\n\n\t// Don't delay database loading until the DHCP server is started,\n\t// because we need static leases functionality available beforehand.\n\terr = s.dbLoad()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loading db: %w\", err)\n\t}\n\n\treturn s, nil\n}","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/dhcpd/dhcpd.go#L122-L158","documentation":"Create refuses to start because DHCP is globally enabled but neither the DHCPv4 nor DHCPv6 block is enabled — i.e. conf.Enabled is true while both Conf4 and Conf6 are inactive (v4 lacks a valid RangeStart, v6 lacks RangeStart).","triggerScenarios":"Calling dhcpd.Create with Enabled=true, Conf4.RangeStart invalid/zero and Conf6.RangeStart empty — e.g. via the API with enabled=true but empty range settings.","commonSituations":"Enabling DHCP in the UI before filling in a range; API scripts setting enabled=true with partial config; defaults after upgrading where ranges are unset.","solutions":["Set a valid IPv4 range_start/range_end or a DHCPv6 range_start before enabling DHCP","Or keep enabled=false until a server block is configured","Validate config in the caller before invoking Create"],"exampleFix":"// before\ncfg.Enabled = true // no ranges set\n// after\ncfg.Enabled = true\ncfg.Conf4.RangeStart = netip.MustParseAddr(\"192.168.1.10\")\ncfg.Conf4.RangeEnd = netip.MustParseAddr(\"192.168.1.254\")","handlingStrategy":"validation","validationCode":"// before Create\nv4ok := conf.Conf4.RangeStart.IsValid()\nv6ok := len(conf.Conf6.RangeStart) != 0\nif conf.Enabled && !v4ok && !v6ok { return errors.New(\"configure a v4 or v6 range first\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set a range before flipping enabled=true","Validate config payloads in API handlers"],"tags":["dhcp","config","validation"],"backgroundTag":"dhcp-no-server-enabled","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}