{"record":{"id":"edf0bcd0e3755217","repo":"kubernetes/kops","slug":"unable-to-configuration-file-s-error-s","errorCode":null,"errorMessage":"unable to configuration file: %s, error: %s","messagePattern":"unable to configuration file: (.+?), error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/toolbox_template.go","lineNumber":244,"sourceCode":"\t\treturn fmt.Errorf(\"unable to write template: %s\", err)\n\t}\n\n\treturn nil\n}\n\n// newTemplateContext is responsible for loading the --values and build a context for the template\nfunc newTemplateContext(files []string, values []string, stringValues []string) (map[string]interface{}, error) {\n\tcontext := make(map[string]interface{})\n\n\tfor _, x := range files {\n\t\tlist, err := expandFiles(utils.ExpandPath(x))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, j := range list {\n\t\t\tcontent, err := os.ReadFile(j)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to configuration file: %s, error: %s\", j, err)\n\t\t\t}\n\n\t\t\tctx := make(map[string]interface{})\n\t\t\tif err := utils.YamlUnmarshal(content, &ctx); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable decode the configuration file: %s, error: %v\", j, err)\n\t\t\t}\n\t\t\tcontext = mergeMaps(context, ctx)\n\t\t}\n\t}\n\n\t// User specified a value via --set\n\tfor _, value := range values {\n\t\tif err := helmstrvals.ParseInto(value, context); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed parsing --set data: %s\", err)\n\t\t}\n\t}\n\n\t// User specified a value via --set-string","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/toolbox_template.go#L226-L262","documentation":"newTemplateContext loads each configuration file given via --values (or config list) with os.ReadFile. If a file cannot be read (missing, permission denied), the command fails with this message naming the file and the OS error. Note the message has a known typo ('unable to configuration file').","triggerScenarios":"Running `kops toolbox template --values <file>` where the file does not exist, is unreadable, or is a directory.","commonSituations":"Typo in --values path; file deleted or moved; running in a container/CI where the values file was not copied; wrong relative path from the working directory.","solutions":["Verify the path exists and is readable: `ls -l <file>`.","Correct the --values path or use an absolute path.","If multiple --values flags are used, check each one; the error names the failing file."],"exampleFix":"// before\nkops toolbox template --values vals.yaml  # vals.yaml does not exist\n// after\nkops toolbox template --values ./config/vals.yaml  # correct, existing path","handlingStrategy":"validation","validationCode":"info, err := os.Stat(valuesPath)\nif err != nil { return fmt.Errorf(\"values file %s missing\", valuesPath) }\nif info.IsDir() { return fmt.Errorf(\"%s is a directory\", valuesPath) }","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"kops\", \"toolbox\", \"template\", \"--values\", p, ...).CombinedOutput()\nif strings.Contains(string(out), \"unable to configuration file\") { verify path/permissions and retry }","preventionTips":["Always verify --values paths exist before running","Use absolute paths in scripts and CI","Mount/copy values files into containers before invoking kops"],"tags":["cli","filesystem","missing-file"],"backgroundTag":"missing-file","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}