larksuite/cli · error
local input path must not use a Windows network or device na
Error message
local input path must not use a Windows network or device namespace
What it means
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.
Source
Thrown at internal/vfs/localfileio/path_local_windows.go:39
}
cleaned := filepath.Clean(path)
// A drive-relative path ("C:foo") carries a volume but is not absolute: it
// resolves against that drive's own current directory, so the location it
// names is not the one this validation can see. It is also how the stream
// check below would be slipped, since "C:" is stripped as the volume and
// the remaining "foo" holds no colon.
if filepath.VolumeName(cleaned) != "" && !filepath.IsAbs(cleaned) {
return fmt.Errorf("path must not be drive-relative; give a full path or a path without a drive letter")
}
if strings.Contains(cleaned[len(filepath.VolumeName(cleaned)):], ":") {
return fmt.Errorf("path must not address an NTFS alternate data stream")
}
return nil
}
func validateLocalInputPlatform(path string) error {
if isWindowsNonLocalNamespace(path) {
return fmt.Errorf("local input path must not use a Windows network or device namespace")
}
cleaned := filepath.Clean(path)
volume := filepath.VolumeName(cleaned)
remainder := strings.TrimLeft(cleaned[len(volume):], `\/`)
for _, component := range strings.FieldsFunc(remainder, func(r rune) bool {
return r == '\\' || r == '/'
}) {
if component == "." || component == ".." {
continue
}
if !filepath.IsLocal(component) {
return fmt.Errorf("local input path contains a reserved Windows path component %q", component)
}
}
return nil
}
View on GitHub (pinned to 7fd6ef3c07)
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
Example fix
// before runtime.FileIO().Read(`\\nas\share\config.json`) // after runtime.FileIO().Read(`C:\data\config.json`)
Defensive patterns
Strategy: validation
Validate before calling
func isNonLocalNamespace(p string) bool {
return strings.HasPrefix(p, `\\`) // UNC (\\server\share) and device (\\.\) namespaces
} Type guard
func isLocalDrivePath(p string) bool {
v := filepath.VolumeName(filepath.Clean(p))
return v != "" && !strings.HasPrefix(v, `\\`) && filepath.IsAbs(p)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- %s: cannot stat %q: %w
- cannot stat opened file: %w
- file changed between validation and open
- not a regular file (directories, devices, FIFOs, and sockets
- cannot inspect opened file links: %w
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/c53d4b4ddc3cf0b5.
Report an issue: GitHub.