{"record":{"id":"c53d4b4ddc3cf0b5","repo":"larksuite/cli","slug":"local-input-path-must-not-use-a-windows-network-or","errorCode":null,"errorMessage":"local input path must not use a Windows network or device namespace","messagePattern":"local input path must not use a Windows network or device namespace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/vfs/localfileio/path_local_windows.go","lineNumber":39,"sourceCode":"\t}\n\tcleaned := filepath.Clean(path)\n\t// A drive-relative path (\"C:foo\") carries a volume but is not absolute: it\n\t// resolves against that drive's own current directory, so the location it\n\t// names is not the one this validation can see. It is also how the stream\n\t// check below would be slipped, since \"C:\" is stripped as the volume and\n\t// the remaining \"foo\" holds no colon.\n\tif filepath.VolumeName(cleaned) != \"\" && !filepath.IsAbs(cleaned) {\n\t\treturn fmt.Errorf(\"path must not be drive-relative; give a full path or a path without a drive letter\")\n\t}\n\tif strings.Contains(cleaned[len(filepath.VolumeName(cleaned)):], \":\") {\n\t\treturn fmt.Errorf(\"path must not address an NTFS alternate data stream\")\n\t}\n\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":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/vfs/localfileio/path_local_windows.go#L21-L57","documentation":"validateLocalInputPlatform rejects input paths using Windows network (UNC \\\\server\\share) or device (\\\\.\\, \\\\.\\pipe) namespaces. Local file I/O in this VFS is restricted to real local filesystem paths; remote/device namespaces require different transports and are blocked up front.","triggerScenarios":"Passing a UNC path like \\\\fileserver\\share\\doc.xlsx, a device path \\\\.\\C:\\..., or a named pipe \\\\.\\pipe\\foo into a local FileIO read/validate call.","commonSituations":"Pointing the CLI at a network share assumed to behave like a local disk, or attempting to read a device/pipe from a file flag.","solutions":["Map the UNC share to a drive letter (net use) — note the resulting path must still be absolute, not drive-relative","Copy the file to a local directory first and use the local path","If a network/device resource is genuinely needed, use the appropriate network-capable API instead of the local FileIO"],"exampleFix":"// before\nruntime.FileIO().Read(`\\\\nas\\share\\config.json`)\n// after\nruntime.FileIO().Read(`C:\\data\\config.json`)","handlingStrategy":"validation","validationCode":"func isNonLocalNamespace(p string) bool {\n\treturn strings.HasPrefix(p, `\\\\`) // UNC (\\\\server\\share) and device (\\\\.\\) namespaces\n}","typeGuard":"func isLocalDrivePath(p string) bool {\n\tv := filepath.VolumeName(filepath.Clean(p))\n\treturn v != \"\" && !strings.HasPrefix(v, `\\\\`) && filepath.IsAbs(p)\n}","tryCatchPattern":null,"preventionTips":["Copy files from network shares to a local directory before passing them to file flags","Never pass \\\\.\\ device or named-pipe paths to file I/O flags","Map shares to drive letters only if the tooling explicitly supports it; prefer local copies"],"tags":["windows","filesystem","unc-path"],"backgroundTag":"windows-device-namespace-path","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"}