{"record":{"id":"de3d8e6b2b2afc96","repo":"cilium/cilium","slug":"invalid-local-router-ip-s","errorCode":null,"errorMessage":"invalid local-router-ip: %s","messagePattern":"invalid local-router-ip: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"daemon/infraendpoints/infra_ip_allocation.go","lineNumber":127,"sourceCode":"\t\tlocalNodeStore: params.LocalNodeStore,\n\t\tmtuManager:     params.MTU,\n\t\tipAllocator:    params.IPAM,\n\t}\n}\n\nconst (\n\tmismatchRouterIPsMsg = \"Mismatch of router IPs found during restoration. The Kubernetes resource contained %s, while the filesystem contained %s. Using the router IP from the filesystem. To change the router IP, specify --%s and/or --%s.\"\n)\n\nfunc (r *infraIPAllocator) GetHealthEndpointRouting() (ipv4, ipv6 *linuxrouting.RoutingInfo) {\n\treturn r.healthEndpointRouting, r.healthEndpointRoutingV6\n}\n\nfunc (r *infraIPAllocator) allocateRouterIPv4(ctx context.Context, family node.AddressingFamily, fromK8s, fromFS net.IP) (net.IP, error) {\n\tif r.daemonConfig.LocalRouterIPv4 != \"\" {\n\t\trouterIP := net.ParseIP(r.daemonConfig.LocalRouterIPv4)\n\t\tif routerIP == nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid local-router-ip: %s\", r.daemonConfig.LocalRouterIPv4)\n\t\t}\n\t\tif r.nodeAddressing.IPv4().AllocationCIDR().Contains(iputil.AddrFromIP(routerIP)) {\n\t\t\tr.logger.Warn(\"Specified router IP is within IPv4 podCIDR.\")\n\t\t}\n\t\treturn routerIP, nil\n\t}\n\n\treturn r.reallocateRouterIPs(ctx, family, fromK8s, fromFS)\n}\n\nfunc (r *infraIPAllocator) allocateRouterIPv6(ctx context.Context, family node.AddressingFamily, fromK8s, fromFS net.IP) (net.IP, error) {\n\tif r.daemonConfig.LocalRouterIPv6 != \"\" {\n\t\trouterIP := net.ParseIP(r.daemonConfig.LocalRouterIPv6)\n\t\tif routerIP == nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid local-router-ip: %s\", r.daemonConfig.LocalRouterIPv6)\n\t\t}\n\t\tif r.nodeAddressing.IPv6().AllocationCIDR().Contains(iputil.AddrFromIP(routerIP)) {\n\t\t\tr.logger.Warn(\"Specified router IP is within IPv6 podCIDR.\")","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/daemon/infraendpoints/infra_ip_allocation.go#L109-L145","documentation":"Returned by allocateRouterIPv4 when the local-router-ip4 daemon config value cannot be parsed by net.ParseIP. It is a configuration validation error — the user-supplied router IPv4 string is malformed.","triggerScenarios":"daemonConfig.LocalRouterIPv4 is set to a string net.ParseIP rejects (wrong format, hostname, empty whitespace, IPv6 in the IPv4 field).","commonSituations":"Typo or extra characters in the agent config/CLI flag --local-router-ipv4; passing a hostname instead of an IP; Helm values with a bad quoted string.","solutions":["Fix the --local-router-ipv4 flag/config value to a valid dotted-quad IPv4 address (e.g. 10.0.0.1)","If an IPv6 was intended, set local-router-ipv6 instead","Unset the option to let the IPAM pool allocate the router IP automatically"],"exampleFix":"// before\nlocal-router-ipv4: \"cilium-router\"\n// after\nlocal-router-ipv4: \"10.0.0.1\"","handlingStrategy":"validation","validationCode":"func validRouterIPv4(s string) error {\n    if s == \"\" { return nil }\n    ip := net.ParseIP(s)\n    if ip == nil || ip.To4() == nil {\n        return fmt.Errorf(\"local-router-ipv4 must be a valid IPv4 address, got %q\", s)\n    }\n    return nil\n}\n// call before starting the daemon","typeGuard":"func isInvalidRouterIPErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"invalid local-router-ip\")\n}","tryCatchPattern":"if err := validRouterIPv4(cfg.LocalRouterIPv4); err != nil {\n    // fail fast at config-load time instead of during IP allocation\n    return fmt.Errorf(\"bad config: %w\", err)\n}","preventionTips":["Validate IP-typed config values at flag/ConfigMap load time","Never pass hostnames or DNS names where an IP literal is expected","Add schema validation (e.g. CEL/JSON schema) to Helm values"],"tags":["configuration","ipam","ipv4","parse-error"],"backgroundTag":"invalid-ip-config","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}