{"record":{"id":"1c1b76bee14e6725","repo":"GoogleContainerTools/skaffold","slug":"unable-to-expand-q-w","errorCode":null,"errorMessage":"unable to expand %q: %w","messagePattern":"unable to expand %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/helm/args.go","lineNumber":55,"sourceCode":"\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util\"\n\tmaps \"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/map\"\n)\n\nconst (\n\tgcsPrefix        = \"gs://\"\n\tvalueFileFromGCS = \"valuefiles_from_gcs\"\n)\n\n// ConstructOverrideArgs creates the command line arguments for overrides\nfunc ConstructOverrideArgs(r *latest.HelmRelease, builds []graph.Artifact, args []string, manifestOverrides map[string]string) ([]string, error) {\n\tfor _, k := range maps.SortKeys(r.SetValues) {\n\t\targs = append(args, \"--set\", fmt.Sprintf(\"%s=%s\", k, r.SetValues[k]))\n\t}\n\n\tfor _, k := range maps.SortKeys(r.SetFiles) {\n\t\texp, err := homedir.Expand(r.SetFiles[k])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to expand %q: %w\", r.SetFiles[k], err)\n\t\t}\n\t\texp = SanitizeFilePath(exp, runtime.GOOS == \"windows\")\n\n\t\targs = append(args, \"--set-file\", fmt.Sprintf(\"%s=%s\", k, exp))\n\t}\n\n\tenvMap := map[string]string{}\n\tfor idx, b := range builds {\n\t\tidxSuffix := \"\"\n\t\t// replace commonly used image name chars that are illegal helm template chars \"/\" & \"-\" with \"_\"\n\t\tnameSuffix := util.SanitizeHelmTemplateValue(b.ImageName)\n\t\tif idx > 0 {\n\t\t\tidxSuffix = strconv.Itoa(idx + 1)\n\t\t}\n\n\t\tfor k, v := range envVarForImage(b.ImageName, b.Tag) {\n\t\t\tenvMap[k+idxSuffix] = v\n\t\t\tenvMap[k+\"_\"+nameSuffix] = v","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/helm/args.go#L37-L73","documentation":"ConstructOverrideArgs builds helm CLI arguments, including `--set-file` entries whose values are files. Each value is passed through homedir.Expand (to resolve `~/`); if expansion fails, the error is wrapped as 'unable to expand %q'. This means the path string could not be expanded to an absolute home-directory path.","triggerScenarios":"Calling ConstructOverrideArgs (via installArgs/templateArgs, i.e. `skaffold helm install/upgrade/template`) with a helm `setFiles` entry whose value fails homedir.Expand — in practice a value that cannot be resolved against the user's home directory, e.g. an empty or malformed `~`-relative path.","commonSituations":"skaffold.yaml helm releases config with `setFiles` entries using `~/...` while HOME is unset (containers, CI); an empty string or typo in the setFiles value.","solutions":["Set the HOME environment variable in the environment running Skaffold (common in containers/CI).","Replace `~/`-relative paths with absolute paths in the helm `setFiles` configuration.","Fix empty or malformed setFiles values in skaffold.yaml.","Verify with `echo $HOME` that the running process can resolve the home directory."],"exampleFix":"// before (skaffold.yaml)\nsetFiles: { config: ~/charts/config.yaml }\n// after (absolute path, or ensure HOME is set)\nsetFiles: { config: /opt/charts/config.yaml }","handlingStrategy":"validation","validationCode":"for k, v := range helmConfig.SetFiles {\n\tif v == \"\" {\n\t\treturn fmt.Errorf(\"helm setFiles[%s] is empty\", k)\n\t}\n\tif strings.HasPrefix(v, \"~/\") && os.Getenv(\"HOME\") == \"\" {\n\t\treturn fmt.Errorf(\"HOME unset; setFiles[%s] uses ~ path\", k)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set HOME in containers and CI runners","Prefer absolute paths over `~/` in skaffold.yaml","Reject empty setFiles values during config linting","Run `skaffold diagnose` to catch config issues early"],"tags":["helm","path-expansion","config"],"backgroundTag":"path-expansion-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"}