{"record":{"id":"7e10da5e652106f4","repo":"hashicorp/nomad","slug":"failed-to-parse-named-repo-q-v","errorCode":null,"errorMessage":"Failed to parse named repo %q: %v","messagePattern":"Failed to parse named repo %q: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/utils.go","lineNumber":91,"sourceCode":"\tcfile := new(configfile.ConfigFile)\n\tif err = cfile.LoadFromReader(f); err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse auth config file: %v\", err)\n\t}\n\treturn cfile, nil\n}\n\n// repositoryInfo contains the subset of repository metadata needed for auth\n// lookup against Docker config files and credential helpers.\ntype repositoryInfo struct {\n\tIndex *registrytypes.IndexInfo\n}\n\n// parseRepositoryInfo takes a repo and returns the repository metadata needed\n// for interacting with a Docker config object.\nfunc parseRepositoryInfo(repo string) (*repositoryInfo, error) {\n\tname, err := reference.ParseNormalizedNamed(repo)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse named repo %q: %v\", repo, err)\n\t}\n\n\tdomain := reference.Domain(name)\n\tindexName := normalizeRegistryIndexName(domain)\n\n\trepoInfo := &repositoryInfo{\n\t\tIndex: &registrytypes.IndexInfo{\n\t\t\tName:     indexName,\n\t\t\tMirrors:  []string{},\n\t\t\tSecure:   true,\n\t\t\tOfficial: indexName == dockerRegistryIndexName,\n\t\t},\n\t}\n\n\treturn repoInfo, nil\n}\n\n// firstValidAuth tries a list of auth backends, returning first error or AuthConfiguration","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/utils.go#L73-L109","documentation":"parseRepositoryInfo wraps any failure from reference.ParseNormalizedNamed when normalizing a Docker image repo string (e.g. \"nginx\", \"docker.io/library/nginx:1.25\"). It reports the exact repo string plus the underlying parse error, so callers know their image reference was not a valid Docker named reference. This happens before any registry lookup or credential helper is invoked.","triggerScenarios":"Calling the docker driver's repository-info helper with a repo string that fails reference.ParseNormalizedNormalizedNamed: invalid characters (uppercase letters, spaces), empty string, more than one colon (e.g. \"myrepo:v1:latest\"), or a tag+digest combination.","commonSituations":"Typo'd image names in Nomad job specs (uppercase in image names, e.g. \"MyApp:latest\"), accidentally pasted registry URLs with ports plus extra colons, template/variable interpolation leaving \"{{image}}\" or empty strings in the jobspec.","solutions":["Fix the image reference in the jobspec/config: lowercase name, at most one tag colon, valid registry path segments.","Validate the reference locally with `docker pull <repo>` or distribution/reference's ParseNormalizedNamed before submitting the job.","If the name is generated, add interpolation validation so empty/placeholder values never reach the driver."],"exampleFix":"// before\nimage = \"MyApp:1.2:latest\"\n// after\nimage = \"myregistry.example.com/myteam/myapp:1.2\" // or \"myapp:1.2\"","handlingStrategy":"validation","validationCode":"const imageRe = /^[a-z0-9]+((\\.|_|__|-+)[a-z0-9]+)*(\\/[a-z0-9]+((\\.|_|__|-+)[a-z0-9]+))*(:[A-Za-z0-9_.-]+)?(@sha256:[a-f0-9]{64})?$/\nif repo === \"\" || !imageRe.test(repo) {\n  return fmt.Errorf(\"invalid image reference %q before calling driver\", repo)\n}","typeGuard":"func isValidRepo(s string) bool { _, err := reference.ParseNormalizedNamed(s); return err == nil }","tryCatchPattern":"repoInfo, err := parseRepositoryInfo(repo)\nif err != nil {\n  return fmt.Errorf(\"bad image spec in job %q: %w\", jobID, err)\n}","preventionTips":["Always lowercase image names and repos.","Keep at most one colon (the tag) unless using @digest.","Validate image strings at job-submission time, not at driver time."],"tags":["docker","image-reference","parsing"],"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"}