{"record":{"id":"822f22f551a31ca1","repo":"larksuite/cli","slug":"local-input-path-contains-a-reserved-windows-path","errorCode":null,"errorMessage":"local input path contains a reserved Windows path component %q","messagePattern":"local input path contains a reserved Windows path component %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/vfs/localfileio/path_local_windows.go","lineNumber":52,"sourceCode":"\treturn nil\n}\n\nfunc validateLocalInputPlatform(path string) error {\n\tif isWindowsNonLocalNamespace(path) {\n\t\treturn fmt.Errorf(\"local input path must not use a Windows network or device namespace\")\n\t}\n\n\tcleaned := filepath.Clean(path)\n\tvolume := filepath.VolumeName(cleaned)\n\tremainder := strings.TrimLeft(cleaned[len(volume):], `\\/`)\n\tfor _, component := range strings.FieldsFunc(remainder, func(r rune) bool {\n\t\treturn r == '\\\\' || r == '/'\n\t}) {\n\t\tif component == \".\" || component == \"..\" {\n\t\t\tcontinue\n\t\t}\n\t\tif !filepath.IsLocal(component) {\n\t\t\treturn fmt.Errorf(\"local input path contains a reserved Windows path component %q\", component)\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":34,"sourceCodeEnd":57,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/vfs/localfileio/path_local_windows.go#L34-L57","documentation":"Each non-dot path component must pass filepath.IsLocal on Windows; reserved names (CON, PRN, AUX, NUL, COM1..9, LPT1..9) and components with reserved characteristics are rejected. This prevents DOS-device name pitfalls where opening CON or NUL has side effects or silently deviates from the intended file.","triggerScenarios":"A path containing a component like CON, NUL, COM1, or a component that filepath.IsLocal deems non-local (e.g. reserved device names with extensions such as notes.txt: not this error, but aux.c works) passed to a local input FileIO operation.","commonSituations":"Files literally named 'aux' or 'con' created by non-Windows tooling (legal on Linux, reserved on Windows) being referenced on a Windows host.","solutions":["Rename the file so no component is a reserved device name (e.g. aux.go -> aux-file.go)","On a Linux/macOS host this check never fires; ensure you are addressing the file on the intended OS","Escape nothing — Windows has no escape for reserved names; the file itself must be renamed"],"exampleFix":"// before\nruntime.FileIO().Read(`C:\\out\\aux`)\n// after\nruntime.FileIO().Read(`C:\\out\\aux-data`)","handlingStrategy":"validation","validationCode":"func hasReservedComponent(p string) bool {\n\tfor _, c := range strings.FieldsFunc(filepath.Clean(p), func(r rune) bool { return r == '\\\\' || r == '/' }) {\n\t\tif c == \".\" || c == \"..\" { continue }\n\t\tif !filepath.IsLocal(c) { return true }\n\t}\n\treturn false\n}","typeGuard":"func allComponentsLocal(p string) bool {\n\tfor _, c := range strings.Split(p, `\\`) {\n\t\tif c != \"\" && c != \".\" && c != \"..\" && !filepath.IsLocal(c) { return false }\n\t}\n\treturn true\n}","tryCatchPattern":null,"preventionTips":["Avoid creating files named after DOS devices (CON, NUL, AUX, COM1-9, LPT1-9), especially from Linux tooling that will later be read on Windows","Sanitize filenames from external sources before saving them","Run filepath.IsLocal on user-supplied components before building paths"],"tags":["windows","filesystem","reserved-names"],"backgroundTag":"windows-reserved-filename","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}