{"record":{"id":"a16bca69038c5869","repo":"larksuite/cli","slug":"s-cannot-stat-q-w-a16bca","errorCode":null,"errorMessage":"%s: cannot stat %q: %w","messagePattern":"(.+?): cannot stat %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/binding/audit_windows.go","lineNumber":23,"sourceCode":"\npackage binding\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/larksuite/cli/internal/vfs\"\n)\n\n// checkOwnerUID is a no-op on Windows where Unix UID semantics don't apply.\nfunc checkOwnerUID(path, label string) error {\n\treturn nil\n}\n\n// auditFilePermissions skips POSIX permission-bit auditing on Windows because\n// Go synthesizes mode bits from file attributes rather than NTFS ACLs.\nfunc auditFilePermissions(effectivePath string, allowReadableByOthers bool, label string) error {\n\tif _, err := vfs.Stat(effectivePath); err != nil {\n\t\treturn fmt.Errorf(\"%s: cannot stat %q: %w\", label, effectivePath, err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":5,"sourceCodeEnd":27,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/binding/audit_windows.go#L5-L27","documentation":"On Windows, auditFilePermissions skips POSIX bit checks (Go's mode bits derive from file attributes, not NTFS ACLs) and only verifies the path exists via vfs.Stat. If the stat fails, the stat error is wrapped with the audit label and path so the caller knows which file could not be verified.","triggerScenarios":"auditFilePermissions is called with effectivePath that does not exist, the process lacks access to it, the path is too long/malformed, or it sits on an unavailable network drive.","commonSituations":"Typo in the secret file path in ~/.lark-channel/config.json; file deleted after config referenced it; permission-protected directory; path containing invalid characters or exceeding MAX_PATH.","solutions":["Verify the path exists: `dir <path>` / `Test-Path <path>`","Correct the path in the config that references the secret file","Grant the current user read access to the file/directory","Use a UNC/absolute path within MAX_PATH limits"],"exampleFix":"// before\nsecret: {\"source\":\"file\",\"path\":\"C:/secrets/app.key\"}   // file missing\n// after\ncopy C:/secrets/backup.key C:/secrets/app.key   # then retry","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(secretPath); err != nil {\n    return fmt.Errorf(\"secret file %q unavailable: %w\", secretPath, err)\n}","typeGuard":null,"tryCatchPattern":"err := cmd.Run()\nvar pathErr *os.PathError\nif errors.As(err, &pathErr) {\n    // pathErr.Path names the file; recreate or fix the reference\n}","preventionTips":["Verify referenced paths exist after editing config.json","Use absolute, validated paths for secret files","Recreate secret files before rotating or moving them"],"tags":["windows","filesystem","stat"],"backgroundTag":"file-not-found","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"}