{"record":{"id":"4bc7394918697272","repo":"hashicorp/nomad","slug":"failed-to-parse-network-interface-v","errorCode":null,"errorMessage":"Failed to parse network-interface: %v","messagePattern":"Failed to parse network-interface: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/config.go","lineNumber":2431,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to parse RPC advertise address: %v\", err)\n\t}\n\tc.AdvertiseAddrs.RPC = addr\n\n\t// Skip serf if server is disabled\n\tif c.Server != nil && c.Server.Enabled {\n\t\taddr, err = normalizeAdvertise(c.AdvertiseAddrs.Serf, c.Addresses.Serf, c.Ports.Serf, c.DevMode)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to parse Serf advertise address: %v\", err)\n\t\t}\n\t\tc.AdvertiseAddrs.Serf = addr\n\t}\n\n\t// Skip network_interface evaluation if not a client\n\tif c.Client != nil && c.Client.Enabled && c.Client.NetworkInterface != \"\" {\n\t\tparsed, err := parseSingleInterfaceTemplate(c.Client.NetworkInterface)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to parse network-interface: %v\", err)\n\t\t}\n\n\t\tc.Client.NetworkInterface = parsed\n\t}\n\n\treturn nil\n}\n\n// parseSingleInterfaceTemplate parses a go-sockaddr template and returns an\n// error if it doesn't result in a single value.\nfunc parseSingleInterfaceTemplate(tpl string) (string, error) {\n\tout, err := template.Parse(tpl)\n\tif err != nil {\n\t\t// Typically something like:\n\t\t// unable to parse template \"{{printfl \\\"en50\\\"}}\": template: sockaddr.Parse:1: function \"printfl\" not defined\n\t\treturn \"\", err\n\t}\n","sourceCodeStart":2413,"sourceCodeEnd":2449,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/config.go#L2413-L2449","documentation":"When a client agent sets client.network_interface, the value (which may be a template) is parsed with parseSingleInterfaceTemplate during normalization. Any template rendering error or invalid interface result is reported as 'Failed to parse network-interface' with the underlying cause. Startup stops because the interface is needed to discover the advertise IP.","triggerScenarios":"client.network_interface containing a template expression that fails (e.g. {{ GetInterfaceIP \"ethX\" }} on a missing interface), or otherwise unparseable interface input, while client.enabled = true.","commonSituations":"Container/VM images where the expected interface name differs (ens5 vs eth0); template braces mistyped in HCL; running as client on a host whose primary NIC was renamed.","solutions":["Fix the template syntax or interface name in client.network_interface","List interfaces on the host (ip link) and use an exact existing name","Omit client.network_interface to let the agent auto-detect the private IP","Inspect the wrapped %v message for the template error"],"exampleFix":"// before\nclient { network_interface = \"{{ GetInterfaceIP \\\"eth0\\\"  }\" } # malformed template\n// after\nclient { network_interface = \"{{ GetInterfaceIP \\\"eth0\\\" }}\" }","handlingStrategy":"validation","validationCode":"name, err := renderTemplate(cfg.Client.NetworkInterface) // must not error\nif err == nil {\n\tif _, err := net.InterfaceByName(strings.TrimSpace(name)); err != nil {\n\t\t// interface missing: fix config before starting agent\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `consul validate` before restarts","Verify template braces and function names","Auto-detect interface by omitting client.network_interface when possible"],"tags":["config","network","template","client"],"backgroundTag":"invalid-network-interface-template","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}