{"record":{"id":"93cc2fdb2b33e8a2","repo":"GoogleContainerTools/skaffold","slug":"unable-to-create-build-args-w","errorCode":null,"errorMessage":"unable to create build args: %w","messagePattern":"unable to create build args: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/graph/dependencies.go","lineNumber":121,"sourceCode":"\tdeps := make([]string, len(res))\n\tcopy(deps, res)\n\treturn deps, nil\n}\n\nfunc (r *dependencyResolverImpl) Reset() {\n\tr.cache = util.NewSyncStore[[]string]()\n}\n\n// sourceDependenciesForArtifact returns the build dependencies for the current artifact.\nfunc sourceDependenciesForArtifact(ctx context.Context, a *latest.Artifact, cfg docker.Config, r docker.ArtifactResolver, tag string) ([]string, error) {\n\tvar (\n\t\tpaths []string\n\t\terr   error\n\t)\n\n\tenvTags, evalErr := docker.EnvTags(tag)\n\tif evalErr != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create build args: %w\", err)\n\t}\n\n\tswitch {\n\tcase a.DockerArtifact != nil:\n\t\t// Required artifacts cannot be resolved when `ResolveDependencyImages` runs prior to a completed build sequence (like `skaffold build` or the first iteration of `skaffold dev`).\n\t\t// However it only affects the behavior for Dockerfiles with ONBUILD instructions, and there's no functional change even for those scenarios.\n\t\t// For single build scenarios like `build` and `run`, it is called for the cache hash calculations which are already handled in `artifactHasher`.\n\t\t// For `dev` it will succeed on the first dev loop and list any additional dependencies found from the base artifact's ONBUILD instructions as a file added instead of modified (see `filemon.Events`)\n\t\tdeps := docker.ResolveDependencyImages(a.Dependencies, r, false)\n\n\t\targs, evalErr := docker.EvalBuildArgsWithEnv(cfg.Mode(), a.Workspace, a.DockerArtifact.DockerfilePath, a.DockerArtifact.BuildArgs, deps, envTags)\n\t\tif evalErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to evaluate build args: %w\", evalErr)\n\t\t}\n\t\tpaths, err = docker.GetDependencies(ctx, docker.NewBuildConfig(a.Workspace, a.ImageName, a.DockerArtifact.DockerfilePath, args), cfg)\n\n\tcase a.KanikoArtifact != nil:\n\t\tdeps := docker.ResolveDependencyImages(a.Dependencies, r, false)","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/graph/dependencies.go#L103-L139","documentation":"sourceDependenciesForArtifact starts by computing Docker env tags via docker.EnvTags(tag); if that fails it wraps the error as 'unable to create build args'. Note a quirk: it wraps `err`, not `evalErr`, so the underlying cause is masked by whatever `err` happened to hold (usually nil). The failure means the tag string could not be parsed into environment-variable build-arg pairs.","triggerScenarios":"Any artifact (docker, kaniko, buildpacks, ko, etc.) going through sourceDependenciesForArtifact when docker.EnvTags(tag) fails — i.e. the resolved image tag contains characters that break tag parsing, or the tag is empty/malformed.","commonSituations":"Image tags produced by custom taggers containing unusual characters or template remnants; an empty tag because upstream resolution failed (see 'unable to resolve tag for image'); misconfigured custom tagger output.","solutions":["Check the resolved tag value — run `skaffold build --tag` or inspect the tagger config for characters that break parsing.","Fix the tagger configuration (envTemplate/custom tags) so it emits a valid Docker tag.","Confirm the upstream artifact resolved a non-empty tag (fix 'unable to resolve tag for image' first if present).","Note the wrapped `err` may be nil due to a wrapping bug — enable debug logging (`-vdebug`) to see the original EnvTags failure."],"exampleFix":"// before (envTemplate tagger with unresolved variable)\n tagName: '{{.MISSING_VAR}}'\n// after\n tagName: '{{.IMAGE_NAME}}-{{.DIGEST}}'","handlingStrategy":"validation","validationCode":"// Validate the resolved tag looks like a Docker tag before dependency resolution\nif tag == \"\" || strings.ContainsAny(tag, \" \\t\\n\") {\n\treturn fmt.Errorf(\"invalid image tag %q before build-args creation\", tag)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only valid tag characters in custom taggers ([A-Za-z0-9_.-])","Add defaults to Dockerfile ARG declarations","Run with -vdebug since the wrapped err may mask the real EnvTags failure","Fix upstream tag resolution failures before dependency computation"],"tags":["docker","build-args","tags"],"backgroundTag":"build-args-evaluation-failed","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"}