{"record":{"id":"aca4f61457eddf84","repo":"lima-vm/lima","slug":"failed-to-read-driver-directory-q-w","errorCode":null,"errorMessage":"failed to read driver directory %#q: %w","messagePattern":"failed to read driver directory %#q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/registry/registry.go","lineNumber":141,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Debugf(\"Discovering external drivers in %v\", stdDriverDirs)\n\tfor _, dir := range stdDriverDirs {\n\t\tif _, err := os.Stat(dir); err == nil {\n\t\t\tif err := discoverDriversInDir(dir); err != nil {\n\t\t\t\tlogrus.Warnf(\"Error discovering external drivers in %#q: %v\", dir, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc discoverDriversInDir(dir string) error {\n\tentries, err := os.ReadDir(dir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read driver directory %#q: %w\", dir, err)\n\t}\n\n\tfor _, entry := range entries {\n\t\tif entry.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\tinfo, err := entry.Info()\n\t\tif err != nil {\n\t\t\tlogrus.Warnf(\"Failed to get info for %#q: %v\", entry.Name(), err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif !isExecutable(info.Mode()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tdriverPath := filepath.Join(dir, entry.Name())","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/registry/registry.go#L123-L159","documentation":"discoverDriversInDir enumerates executable `lima-driver-*` files in a driver directory (standard libexec dirs or paths from LIMA_DRIVERS). This error wraps an os.ReadDir failure, meaning the directory itself could not be read — it doesn't exist, has wrong permissions, or an I/O error occurred. The caller (discoverDrivers) logs it as a warning and continues, so external drivers from that directory are simply unavailable.","triggerScenarios":"os.ReadDir(dir) fails inside discoverDriversInDir: the LIMA_DRIVERS path entry or the standard libexec/lima driver directory does not exist (ENOENT), is not readable by the current user (EACCES/EPERM), or a filesystem error occurs while listing it.","commonSituations":"LIMA_DRIVERS set to a directory that was deleted or misspelled; installing external drivers into a root-only-readable directory and running limactl as a non-root user; an NFS/permission issue on the libexec directory after a partial uninstall or package upgrade.","solutions":["Check the directory exists and is readable: `ls -la <dir>` (the dir path is quoted in the error message); fix the path or permissions with `chmod o+rx <dir>`.","If LIMA_DRIVERS points at the bad directory, correct or unset the variable so only the standard driver dirs are scanned.","Reinstall the external driver package (or create the directory) so the expected `lima-driver-*` location exists."],"exampleFix":"// before\nexport LIMA_DRIVERS=/usr/local/lib/lima-drivers  # directory missing\n// after\nexport LIMA_DRIVERS=$HOME/.local/libexec/lima     # existing, readable directory\n# or: sudo chmod a+rx /usr/local/libexec/lima","handlingStrategy":"validation","validationCode":"// Before relying on external drivers, ensure each directory in LIMA_DRIVERS exists and is readable:\n// for d in $(IFS=:; echo $LIMA_DRIVERS); do [ -d \"$d\" ] && [ -r \"$d\" ] && [ -x \"$d\" ] || echo \"unusable driver dir: $d\"; done\n// Also verify standard dirs: [ -d \"$(brew --prefix)/libexec/lima\" ] 2>/dev/null || true","typeGuard":null,"tryCatchPattern":"// discovery failures are logged-and-skipped by Lima; to detect them yourself:\nif err := discoverDriversInDir(dir); err != nil {\n\tvar perr *fs.PathError\n\tif errors.As(err, &perr) && errors.Is(perr.Err, fs.ErrPermission) {\n\t\tlog.Warnf(\"driver dir %s not readable: %v; fix with chmod o+rx\", dir, err)\n\t}\n}","preventionTips":["Always create the LIMA_DRIVERS directory before setting the variable; don't point it at a path that may be removed by upgrades.","Make driver directories world-readable/executable (0755) so non-root limactl can scan them.","After package upgrades or uninstall scripts, re-check that lima-driver-* files and their parent directory still exist."],"tags":["filesystem","drivers","permissions","plugin-discovery"],"backgroundTag":"directory-not-readable","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}