{"record":{"id":"037c270eabe12677","repo":"quarkusio/quarkus","slug":"unable-to-scan-next","errorCode":null,"errorMessage":"Unable to scan: ${next}","messagePattern":"Unable to scan: (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/watch/WatchServiceFileSystemWatcher.java","lineNumber":250,"sourceCode":"            watchService.close();\n        }\n    }\n\n    private static Map<Path, Long> doScan(Path directory) {\n        final Map<Path, Long> results = new HashMap<>();\n\n        final Deque<Path> toScan = new ArrayDeque<>();\n        toScan.add(directory);\n        while (!toScan.isEmpty()) {\n            Path next = toScan.pop();\n            if (Files.isDirectory(next)) {\n                try {\n                    results.put(next, Files.getLastModifiedTime(directory).toMillis());\n                    try (Stream<Path> list = Files.list(next)) {\n                        list.forEach(p -> toScan.push(p.toAbsolutePath()));\n                    }\n                } catch (IOException e) {\n                    throw new UncheckedIOException(\"Unable to scan: \" + next, e);\n                }\n            }\n        }\n        return results;\n    }\n\n    private static void invokeCallback(FileChangeCallback callback, List<FileChangeEvent> results) {\n        try {\n            callback.handleChanges(results);\n        } catch (Exception e) {\n            log.error(\"Failed to invoke watch callback\", e);\n        }\n    }\n\n    private class PathData {\n\n        private final Path path;\n        private final List<FileChangeCallback> callbacks = new ArrayList<>();","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/watch/WatchServiceFileSystemWatcher.java#L232-L268","documentation":"WatchServiceFileSystemWatcher.doScan walks registered directories to snapshot last-modified times; if Files.list or getLastModifiedTime throws IOException for any path, it is rethrown as UncheckedIOException 'Unable to scan: <path>'. It means the dev-mode change scanner cannot read a directory it was asked to watch.","triggerScenarios":"allDirectories() -> doScan() iterating watched dirs when a directory disappears (deleted during scan), permission is denied, or a symlink is broken.","commonSituations":"A watched directory deleted while dev mode runs (clean, git checkout/branch switch); permission changes; too many open files (ulimit) breaking Files.list; broken symlinks in the project tree.","solutions":["Check the path named in the message: restore it, remove broken symlinks, or fix permissions","Run git clean/reset or restart quarkus:dev after mass file operations like branch switches","Raise the open-file limit (ulimit -n) if 'Too many open files' appears as the cause","Exclude volatile paths (node_modules, generated dirs) from watching if applicable"],"exampleFix":"// before: branch switch removes watched dir, scan fails\n// after: restart dev mode after large checkouts, or fix path\nrm -rf node_modules && npm ci  # recreate missing/legacy paths\nulimit -n 4096","handlingStrategy":"validation","validationCode":"for (Path dir : watchedDirs) {\n    if (!Files.isReadable(dir)) throw new IllegalStateException(\"Watched dir not readable: \" + dir);\n    if (Files.isSymbolicLink(dir) && !Files.exists(dir.toRealPath())) throw new IllegalStateException(\"Broken symlink: \" + dir);\n}","typeGuard":null,"tryCatchPattern":"try {\n    watcher.scan();\n} catch (UncheckedIOException e) {\n    if (e.getMessage().startsWith(\"Unable to scan:\")) {\n        Path bad = Path.of(e.getMessage().replace(\"Unable to scan: \", \"\"));\n        // re-register or skip the missing directory, then rescan\n    }\n    throw e;\n}","preventionTips":["Avoid branch switches/cleans that delete watched directories during live reload; restart dev mode afterwards","Keep ulimit -n high enough for many open directory streams","Remove broken symlinks from the project tree"],"tags":["filesystem","watch-service","dev-mode"],"backgroundTag":"directory-scan-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}