{"record":{"id":"57dd6cddc11a71b2","repo":"kubernetes/kops","slug":"cannot-parse-file-mode-q","errorCode":null,"errorMessage":"cannot parse file mode %q","messagePattern":"cannot parse file mode %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/files.go","lineNumber":149,"sourceCode":"\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\n\tif actual.Equal(expected) {\n\t\tklog.V(2).Infof(\"Hash matched for %q: %v\", f, expected)\n\t\treturn true, nil\n\t}\n\tklog.V(2).Infof(\"Hash did not match for %q: actual=%v vs expected=%v\", f, actual, expected)\n\treturn false, nil\n}\n\nfunc ParseFileMode(s string, defaultMode os.FileMode) (os.FileMode, error) {\n\tfileMode := defaultMode\n\tif s != \"\" {\n\t\tv, err := strconv.ParseUint(s, 8, 32)\n\t\tif err != nil {\n\t\t\treturn fileMode, fmt.Errorf(\"cannot parse file mode %q\", s)\n\t\t}\n\t\tfileMode = os.FileMode(v)\n\t}\n\treturn fileMode, nil\n}\n\nfunc FileModeToString(mode os.FileMode) string {\n\treturn \"0\" + strconv.FormatUint(uint64(mode), 8)\n}\n\nfunc SafeClose(r io.Reader) {\n\tif r == nil {\n\t\treturn\n\t}\n\tcloser, ok := r.(io.Closer)\n\tif !ok {\n\t\treturn\n\t}","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/files.go#L131-L167","documentation":"Thrown by ParseFileMode when the provided string is non-empty but not a valid octal number (parsed with strconv.ParseUint base 8). The mode string is typically user-supplied config, e.g. a file mode like \"0644\"; values like \"644 \" (non-octal chars), \"0999\" (invalid octal digit), or \"rw-r--r--\" trigger this.","triggerScenarios":"Thrown at upup/pkg/fi/files.go:149 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid octal mode string such as \"0644\" or \"0755\"","Remove stray characters, spaces, or symbolic notation like rw-r--r-- from the mode value","Locate the config field (e.g. file mode in the spec or asset config) that carried the bad string"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}