{"record":{"id":"e5b42461e7ceea95","repo":"hashicorp/nomad","slug":"check-q-cannot-use-address-mode-alloc-ipv6-onl","errorCode":null,"errorMessage":"check %q cannot use address_mode=\"alloc_ipv6\", only checks defined in a \"group\" service block can use this mode","messagePattern":"check %q cannot use address_mode=\"alloc_ipv6\", only checks defined in a \"group\" service block can use this mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":8531,"sourceCode":"\t\t// connect block is only allowed on group level\n\t\tif service.Connect != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"service %q cannot have \\\"connect\\\" block, only services defined in a \\\"group\\\" block can\", service.Name))\n\t\t}\n\n\t\t// Ensure that check names are unique and have valid ports\n\t\tknownChecks := make(map[string]struct{})\n\t\tfor _, check := range service.Checks {\n\t\t\tif _, ok := knownChecks[check.Name]; ok {\n\t\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"check %q is duplicate\", check.Name))\n\t\t\t}\n\t\t\tknownChecks[check.Name] = struct{}{}\n\n\t\t\tif check.AddressMode == AddressModeAlloc {\n\t\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"check %q cannot use address_mode=\\\"alloc\\\", only checks defined in a \\\"group\\\" service block can use this mode\", service.Name))\n\t\t\t}\n\n\t\t\tif check.AddressMode == AddressModeAllocIPv6 {\n\t\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"check %q cannot use address_mode=\\\"alloc_ipv6\\\", only checks defined in a \\\"group\\\" service block can use this mode\", service.Name))\n\t\t\t}\n\n\t\t\tif !check.RequiresPort() {\n\t\t\t\t// No need to continue validating check if it doesn't need a port\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\teffectivePort := check.PortLabel\n\t\t\tif effectivePort == \"\" {\n\t\t\t\t// Inherits from service\n\t\t\t\teffectivePort = service.PortLabel\n\t\t\t}\n\n\t\t\tif effectivePort == \"\" {\n\t\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"check %q is missing a port\", check.Name))\n\t\t\t\tcontinue\n\t\t\t}\n","sourceCodeStart":8513,"sourceCodeEnd":8549,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L8513-L8549","documentation":"The IPv6 counterpart for checks: address_mode=\"alloc_ipv6\" on a check is only valid when the check belongs to a service declared in a \"group\" block. Task-level checks cannot claim the allocation's IPv6 address, so validation rejects it, attributing the error to the parent service name.","triggerScenarios":"Submitting a job with check.address_mode = \"alloc_ipv6\" (AddressModeAllocIPv6) inside a task-level service.","commonSituations":"Configuring IPv6 health checks after copying group-level check stanzas into task-level services; cluster-wide IPv6 migration where address modes were added indiscriminately.","solutions":["Move the parent service (with the check) to the group level.","Remove or change the check's address_mode to \"driver\" or \"host\".","Validate the job locally with `nomad job validate` before submitting."],"exampleFix":"// before\ntask \"app\" {\n  service {\n    name = \"api\"\n    check { name = \"live\"; address_mode = \"alloc_ipv6\"; port = \"8080\" }\n  }\n}\n\n// after\ngroup \"web\" {\n  service {\n    name = \"api\"\n    check { name = \"live\"; address_mode = \"alloc_ipv6\"; port = \"8080\" }\n  }\n  task \"app\" { }\n}","handlingStrategy":"validation","validationCode":"for taskLevelChecks {\n  if c.AddressMode == \"alloc_ipv6\" {\n    return fmt.Errorf(\"check %q: alloc_ipv6 address_mode requires a group-level service\", c.Name)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Place alloc_ipv6 checks only under group-level services","Audit IPv6-migration diffs for check address modes added to task services","Use `nomad job validate` as a pre-submit gate"],"tags":["nomad","health-check","ipv6","address-mode"],"backgroundTag":"invalid-service-address-mode","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"}