{"record":{"id":"5800ccd758f4d92f","repo":"GoogleContainerTools/skaffold","slug":"cannot-add-an-empty-image-value","errorCode":null,"errorMessage":"cannot add an empty image value","messagePattern":"cannot add an empty image value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/skaffold/app/flags/image.go","lineNumber":123,"sourceCode":"\n\tfor _, image := range i.images {\n\t\tartifacts = append(artifacts, *image.artifact)\n\t}\n\n\treturn artifacts\n}\n\n// NewEmptyImages returns a new nil Images list.\nfunc NewEmptyImages(usage string) *Images {\n\treturn &Images{\n\t\timages: []image{},\n\t\tusage:  usage,\n\t}\n}\n\nfunc convertImageToArtifact(value string) (*graph.Artifact, error) {\n\tif value == \"\" {\n\t\treturn nil, errors.New(\"cannot add an empty image value\")\n\t}\n\tif c := strings.SplitN(value, \"=\", 2); len(c) == 2 {\n\t\t_, err := docker.ParseReference(c[1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &graph.Artifact{\n\t\t\tImageName: c[0],\n\t\t\tTag:       c[1],\n\t\t}, nil\n\t}\n\tparsed, err := docker.ParseReference(value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &graph.Artifact{\n\t\tImageName: parsed.BaseName,\n\t\tTag:       value,","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/cmd/skaffold/app/flags/image.go#L105-L141","documentation":"The --images / image flag parser converts each `image[=tag]` value into an artifact via convertImageToArtifact. It rejects empty strings outright, then parses anything after '=' as a docker reference. An empty image value (empty string or a lone '=' with empty parts handling) fails immediately with this error.","triggerScenarios":"Passing `--images=` (empty value), an empty element from a repeated flag or env-injected variable, or calling flag.AppendValue/Replace APIs with \"\" programmatically (e.g. from `skaffold run --images \"$IMAGES\"` with IMAGES unset).","commonSituations":"CI env var interpolation yielding an empty string; scripts building a comma list where a trailing/leading element is empty; IDE run configurations with a blank images field.","solutions":["Provide a valid image name: `--images my-image:tag`","Guard shell variables: `skaffold run --images \"${IMAGES:?image required}\"`","Strip empty entries before joining lists: filter empty strings out of the comma-separated value"],"exampleFix":"// before\nskaffold run --images \"$IMAGES\"\n// after\nskaffold run --images \"${IMAGES:?IMAGES must be set to an image name}\"","handlingStrategy":"validation","validationCode":"images=$(echo \"$IMAGES\" | tr ',' '\\n' | sed '/^$/d' | paste -sd, -)\n[ -n \"$images\" ] || { echo \"no images provided\"; exit 1; }\nskaffold run --images=\"$images\"","typeGuard":"function isValidImageValue(v) { return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"try {\n  skaffold run(['--images=' + img]);\n} catch (e) {\n  if (String(e).includes('cannot add an empty image value')) {\n    console.error('Provide a non-empty image name, e.g. --images my-image:tag');\n  }\n}","preventionTips":["Never interpolate possibly-empty env vars into --images","Filter empty entries out of comma-separated image lists","Sanity-check that each image value matches name[:tag] form"],"tags":["flags","validation","docker-images","skaffold"],"backgroundTag":"empty-required-value","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}