{"record":{"id":"88239ad31955dfc6","repo":"hashicorp/nomad","slug":"does-not-match-registry-specification","errorCode":null,"errorMessage":"does not match registry specification","messagePattern":"does not match registry specification","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/utils.go","lineNumber":30,"sourceCode":"\t\"os/exec\"\n\t\"path/filepath\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\n\t\"github.com/distribution/reference\"\n\t\"github.com/docker/cli/cli/config/configfile\"\n\t\"github.com/docker/cli/cli/config/types\"\n\tregistrytypes \"github.com/moby/moby/api/types/registry\"\n)\n\nconst (\n\tdockerRegistryIndexName   = \"docker.io\"\n\tdockerRegistryIndexServer = \"https://index.docker.io/v1/\"\n)\n\nvar (\n\tNoPathInImageErr = errors.New(\"does not match registry specification\")\n)\n\nfunc parseDockerImage(image string) (string, string, error) {\n\tmatches := reference.ReferenceRegexp.FindStringSubmatch(image)\n\tif matches == nil {\n\t\treturn \"\", \"\", NoPathInImageErr\n\t}\n\n\trepo := matches[1]\n\ttag := matches[2]\n\tdigest := matches[3]\n\n\tif digest == \"\" {\n\t\tif tag == \"\" {\n\t\t\ttag = \"latest\"\n\t\t}\n\t} else {\n\t\trepo = fmt.Sprintf(\"%s@%s\", repo, digest)","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/utils.go#L12-L48","documentation":"NoPathInImageErr is returned by parseDockerImage when the image string does not match the Docker reference specification regex (reference.ReferenceRegexp), meaning it has no valid repository path. The error text 'does not match registry specification' signals the image reference is malformed for the Docker API.","triggerScenarios":"Calling parseDockerImage (used by the Docker driver when starting a task) with strings like \"wrong-docker-image:\" (tag separator with no tag) or an empty string, where FindStringSubmatch yields no matches.","commonSituations":"Typos or trailing colons in job `image` fields; environment-variable-interpolated image names that resolve empty; hand-built image strings missing a tag/digest.","solutions":["Correct the image reference in the job spec to a valid form, e.g. `nginx:1.25` or `my-registry:9090/hello-world:my-tag`","Remove dangling ':' separators or empty segments from the image string","Validate the image string with the Docker CLI (`docker pull <image>`) before deploying","Ensure interpolated variables (e.g. ${IMAGE}) are actually set at job submission"],"exampleFix":"// before\nconfig { image = \"wrong-docker-image:\" }\n// after\nconfig { image = \"wrong-docker-image:latest\" }","handlingStrategy":"validation","validationCode":"var refRegexp = regexp.MustCompile(referenceRegexpPattern)\nfunc validImageRef(image string) bool {\n    return image != \"\" && refRegexp.MatchString(image)\n}\n// call before assigning to job config:\nif !validImageRef(image) { return fmt.Errorf(\"image %q does not match registry specification\", image) }","typeGuard":"func isNoPathInImageErr(err error) bool { return errors.Is(err, NoPathInImageErr) }","tryCatchPattern":"repo, tag, err := parseDockerImage(image)\nif err != nil {\n    if errors.Is(err, NoPathInImageErr) {\n        return fmt.Errorf(\"invalid image reference %q: must include a valid repository path and tag\", image)\n    }\n    return err\n}","preventionTips":["Validate interpolated image variables are non-empty at job submission","Always include an explicit tag or digest in image references","Test image strings with `docker pull` or the reference regex before deploy","Avoid hand-concatenating registry host + image strings"],"tags":["nomad","docker","image-reference","validation"],"backgroundTag":"invalid-image-reference","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"}