{"record":{"id":"08d0cce29e6a689e","repo":"router-for-me/CLIProxyAPI","slug":"failed-to-read-auth-dir-w","errorCode":null,"errorMessage":"failed to read auth dir: %w","messagePattern":"failed to read auth dir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/auth_callbacks.go","lineNumber":160,"sourceCode":"\t\t\t\tentries = append(entries, *entry)\n\t\t\t}\n\t\t}\n\t\tsort.Slice(entries, func(i, j int) bool {\n\t\t\treturn strings.ToLower(entries[i].Name) < strings.ToLower(entries[j].Name)\n\t\t})\n\t\treturn entries, nil\n\t}\n\treturn h.listAuthFilesFromDisk()\n}\n\nfunc (h *Host) listAuthFilesFromDisk() ([]pluginapi.HostAuthFileEntry, error) {\n\tauthDir := h.resolvedAuthDir()\n\tif authDir == \"\" {\n\t\treturn nil, fmt.Errorf(\"auth directory is unavailable\")\n\t}\n\tentries, errReadDir := os.ReadDir(authDir)\n\tif errReadDir != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read auth dir: %w\", errReadDir)\n\t}\n\tfiles := make([]pluginapi.HostAuthFileEntry, 0)\n\tfor _, entry := range entries {\n\t\tif entry.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tname := entry.Name()\n\t\tif !strings.HasSuffix(strings.ToLower(name), \".json\") {\n\t\t\tcontinue\n\t\t}\n\t\tfull := filepath.Join(authDir, name)\n\t\tfileEntry := pluginapi.HostAuthFileEntry{\n\t\t\tName:   name,\n\t\t\tSource: \"file\",\n\t\t\tPath:   full,\n\t\t}\n\t\tif info, errInfo := entry.Info(); errInfo == nil {\n\t\t\tfileEntry.Size = info.Size()","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/auth_callbacks.go#L142-L178","documentation":"os.ReadDir on the resolved auth directory failed; the wrapped error carries the OS cause (most commonly 'no such file or directory' or 'permission denied'). The plugin's attempt to enumerate auth files fails at the filesystem level.","triggerScenarios":"Auth dir path exists in config but is absent on disk (deleted, never created, wrong volume mounted), or the process lacks read/execute permission on it, or it was replaced by a file.","commonSituations":"Container deployment missing a volume mount for auths/; auth dir removed by cleanup scripts; permissions changed after running as a different user; typo in the configured path.","solutions":["Create the directory: mkdir -p <auth-dir> with ownership matching the server user","Check the exact OS error in the wrapped message: ENOENT → create/mount the dir, EACCES → chmod/chown the dir","Verify the configured path spelling and that the container/host mounts it","Restart or retry once the filesystem is fixed"],"exampleFix":"mkdir -p ./auths && chown $(id -u):$(id -g) ./auths","handlingStrategy":"fallback","validationCode":"// Pre-flight before listing auth files:\ndir := host.ResolvedAuthDir()\nif dir == \"\" {\n    return errors.New(\"auth dir unresolved\")\n}\nif _, err := os.Stat(dir); err != nil {\n    if mkErr := os.MkdirAll(dir, 0o700); mkErr != nil { return mkErr }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create the auth dir in entrypoint scripts (mkdir -p) with correct ownership","Run the server under a user with read access to the auth dir","Mount the auths volume in containers and verify with a healthcheck"],"tags":["plugin","auth","filesystem","permissions","deployment"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}