{"record":{"id":"685b2e9a2e94e0e8","repo":"AdguardTeam/AdGuardHome","slug":"checking-static-ip-w","errorCode":null,"errorMessage":"checking static ip: %w","messagePattern":"checking static ip: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"internal/dhcpd/http_unix.go","lineNumber":203,"sourceCode":"\t\t\t// is installed using Snap.  That doesn't necessarily mean that the\n\t\t\t// machine doesn't have a static IP, so we can assume that it has\n\t\t\t// and go on.  If the machine doesn't, we'll get an error later.\n\t\t\t//\n\t\t\t// See https://github.com/AdguardTeam/AdGuardHome/issues/2667.\n\t\t\t//\n\t\t\t// TODO(a.garipov): I was thinking about moving this into\n\t\t\t// IfaceHasStaticIP, but then we wouldn't be able to log it.  Think\n\t\t\t// about it more.\n\t\t\tlog.Info(\"error while checking static ip: %s; \"+\n\t\t\t\t\"assuming machine has static ip and going on\", err)\n\t\t\thasStaticIP = true\n\t\t} else if errors.Is(err, aghnet.ErrNoStaticIPInfo) {\n\t\t\t// Couldn't obtain a definitive answer.  Assume static IP an go on.\n\t\t\tlog.Info(\"can't check for static ip; \" +\n\t\t\t\t\"assuming machine has static ip and going on\")\n\t\t\thasStaticIP = true\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"checking static ip: %w\", err)\n\n\t\t\treturn http.StatusInternalServerError, err\n\t\t}\n\t}\n\n\tif !hasStaticIP {\n\t\terr = aghnet.IfaceSetStaticIP(ctx, s.conf.Logger, cmdCons, ifaceName)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"setting static ip: %w\", err)\n\n\t\t\treturn http.StatusInternalServerError, err\n\t\t}\n\t}\n\n\terr = s.Start(ctx)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, fmt.Errorf(\"starting dhcp server: %w\", err)\n\t}","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/dhcpd/http_unix.go#L185-L221","documentation":"While enabling DHCP (set-config), the pre-flight check to determine whether the machine's interface IP is static failed with an unexpected error (not ErrNoStaticIPInfo). Wrapped as 'checking static ip' and returned with HTTP 500.","triggerScenarios":"Calling handleDHCPSetConfig to enable DHCP when the static-IP detection (aghnet) fails — e.g. cannot query system network configuration, unsupported platform network stack, or command execution failure.","commonSituations":"Running in containers or minimal environments lacking standard network config utilities; changed system permissions; OS/distro where the detection mechanism doesn't work.","solutions":["Check the wrapped error for the underlying cause","Run in a standard environment with network utilities available, or grant the needed privileges","If running in a container/DIY setup, ensure the host network info is inspectable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := enableDHCP(...); err != nil {\n    if errors.Is(err, aghnet.ErrNoStaticIPInfo) { /* proceed, treated as static */ }\n    if strings.Contains(err.Error(), \"checking static ip\") { /* 500: surface env issue */ }\n}","preventionTips":["Run in environments with standard network tooling","Prevent by setting a static IP manually so the check path is exercised"],"tags":["dhcp","network","static-ip","http-500"],"backgroundTag":"static-ip-check-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}