{"record":{"id":"5577554edbf3f98a","repo":"hashicorp/nomad","slug":"failed-to-parse-mac-address-q-v","errorCode":null,"errorMessage":"failed to parse mac_address %q: %v","messagePattern":"failed to parse mac_address %q: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/driver.go","lineNumber":1579,"sourceCode":"\t\t\t}\n\t\t\tipamConfig.IPv4Address = ipv4\n\t\t}\n\t\tif driverConfig.IPv6Address != \"\" {\n\t\t\tipv6, err := netip.ParseAddr(driverConfig.IPv6Address)\n\t\t\tif err != nil {\n\t\t\t\treturn c, fmt.Errorf(\"failed to parse ipv6_address %q: %v\", driverConfig.IPv6Address, err)\n\t\t\t}\n\t\t\tipamConfig.IPv6Address = ipv6\n\t\t}\n\t\tnetworkingConfig.EndpointsConfig[string(hostConfig.NetworkMode)].IPAMConfig = ipamConfig\n\t\tlogger.Debug(\"setting container network configuration\", \"network_mode\", hostConfig.NetworkMode,\n\t\t\t\"ipv4_address\", driverConfig.IPv4Address, \"ipv6_address\", driverConfig.IPv6Address)\n\t}\n\n\tif driverConfig.MacAddress != \"\" {\n\t\tmac, err := net.ParseMAC(driverConfig.MacAddress)\n\t\tif err != nil {\n\t\t\treturn c, fmt.Errorf(\"failed to parse mac_address %q: %v\", driverConfig.MacAddress, err)\n\t\t}\n\n\t\tif networkingConfig == nil {\n\t\t\tnetworkingConfig = &networkapi.NetworkingConfig{\n\t\t\t\tEndpointsConfig: map[string]*networkapi.EndpointSettings{\n\t\t\t\t\tstring(hostConfig.NetworkMode): {},\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tnetworkingConfig.EndpointsConfig[string(hostConfig.NetworkMode)].MacAddress = networkapi.HardwareAddr(mac)\n\n\t\tlogger.Debug(\"setting container mac address\", \"mac_address\", driverConfig.MacAddress)\n\t}\n\n\tif driverConfig.Healthchecks.Disabled() {\n\t\t// Override any image-supplied health-check with disable sentinel.\n\t\t// https://github.com/docker/engine-api/blob/master/types/container/config.go#L16\n\t\tconfig.Healthcheck = &containerapi.HealthConfig{Test: []string{\"NONE\"}}","sourceCodeStart":1561,"sourceCodeEnd":1597,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/driver.go#L1561-L1597","documentation":"The Docker driver parses driverConfig.MacAddress with net.ParseMAC before attaching it to the container's networking config. If the MAC address string is not in a valid format (e.g. aa:bb:cc:dd:ee:ff, aa-bb-cc-dd-ee-ff, or aa.bb.cc.dd.ee.ff), this error is returned and the task fails to start.","triggerScenarios":"A task config sets mac_address to a string that net.ParseMAC rejects — wrong separators, wrong number of octets, non-hex characters, or an empty-but-whitespace value.","commonSituations":"Typos in job specs, mixing separator styles (aa:bb-cc:...), supplying only 5 octets, or copying a MAC with surrounding whitespace/quotes.","solutions":["Correct mac_address to a full 6-octet MAC with consistent separators, e.g. \"aa:bb:cc:dd:ee:ff\".","Trim whitespace and re-check with `echo '<value>' | grep -iE '^([0-9a-f]{2}[:-]){5}[0-9a-f]{2}$'`.","Ensure the address is unique on the target network to avoid later Docker conflicts."],"exampleFix":"// before\nconfig {\n  mac_address = \"aa-bb-cc-dd-ee\"\n}\n// after\nconfig {\n  mac_address = \"aa:bb:cc:dd:ee:ff\"\n}","handlingStrategy":"validation","validationCode":"import \"net\"\nfunc validMAC(s string) bool { _, err := net.ParseMAC(s); return err == nil }\n// check validMAC(cfg.MacAddress) before submitting","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use six hex octets with one consistent separator style","Grep job files for mac_address values against a regex in CI","Ensure uniqueness across containers on the same network"],"tags":["docker","nomad","mac-address","config-validation"],"backgroundTag":"invalid-mac-address","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"}