{"record":{"id":"0b921d7b0e1e2845","repo":"docker/compose","slug":"invalid-mac-address-w","errorCode":null,"errorMessage":"invalid MAC address: %w","messagePattern":"invalid MAC address: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/create.go","lineNumber":1572,"sourceCode":"\t\t\tauxAddress[auxName] = auxAddr\n\t\t}\n\n\t}\n\treturn network.IPAMConfig{\n\t\tSubnet:     subNet,\n\t\tIPRange:    ipRange,\n\t\tGateway:    gateway,\n\t\tAuxAddress: auxAddress,\n\t}, nil\n}\n\nfunc parseMACAddr(macAddress string) (network.HardwareAddr, error) {\n\tif macAddress == \"\" {\n\t\treturn nil, nil\n\t}\n\tm, err := net.ParseMAC(macAddress)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid MAC address: %w\", err)\n\t}\n\treturn network.HardwareAddr(m), nil\n}\n","sourceCodeStart":1554,"sourceCodeEnd":1576,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/create.go#L1554-L1576","documentation":"A static MAC address configured for a service's network interface failed net.ParseMAC in parseMACAddr. Docker requires standard IEEE 802 forms (01:23:45:67:89:ab, 01-23-45-67-89-ab, or dot notation); anything else is rejected before the create call.","triggerScenarios":"networks: {mac_address: 00:11:22:33:44} (5 groups), 'O0:11:...' with letter O, or an EUI-64 with wrong length under services.*.networks.<name>.mac_address.","commonSituations":"Odd group count, invalid hex chars, copy-paste with spaces; also per-interface mac_address on the service network config.","solutions":["Use exactly 6 hex pairs for IPv4 NICs: 02:42:ac:11:00:02","Remove mac_address to let Docker assign one dynamically","Validate the value with a regex/parser before deploying"],"exampleFix":"# before\nmac_address: \"00:11:22:33:44\"\n# after\nmac_address: \"02:11:22:33:44:55\"","handlingStrategy":"validation","validationCode":"if mac := svc.MacAddress; mac != \"\" { // or per-network entry\n    if _, err := net.ParseMAC(string(mac)); err != nil {\n        return fmt.Errorf(\"invalid mac_address %q: %w\", mac, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate MACs with net.HardwareAddr.String() when templating","Omit mac_address unless static MACs are required"],"tags":["network","mac-address","validation"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}