{"record":{"id":"f6e2f2a6e6985607","repo":"quarkusio/quarkus","slug":"unable-to-collect-the-target-directories","errorCode":null,"errorMessage":"Unable to collect the target directories","messagePattern":"Unable to collect the target directories","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateConfigDocMojo.java","lineNumber":311,"sourceCode":"\n                    // a directory containing a .git file or directory is the root of a separate checkout\n                    // (e.g. a git worktree for another branch kept inside the project directory); its\n                    // target/ directories belong to a different build and must not be merged into this one.\n                    // this doesn't apply to the scan root itself, which is normally the project's own repo root.\n                    if (!dir.equals(scanDirectory) && Files.exists(dir.resolve(\".git\"))) {\n                        return FileVisitResult.SKIP_SUBTREE;\n                    }\n\n                    return FileVisitResult.CONTINUE;\n                }\n            });\n\n            // Make sure we are deterministic\n            Collections.sort(targets);\n\n            return targets;\n        } catch (IOException e) {\n            throw new MojoExecutionException(\"Unable to collect the target directories\", e);\n        }\n    }\n\n    private static Engine initializeQuteEngine(Formatter formatter, Set<String> duplicatePropertyPaths, Format format,\n            String theme) {\n        EngineBuilder engineBuilder = Engine.builder()\n                .addDefaults()\n                .addSectionHelper(new UserTagSectionHelper.Factory(\"configProperty\", \"configProperty\"))\n                .addSectionHelper(new UserTagSectionHelper.Factory(\"configSection\", \"configSection\"))\n                .addSectionHelper(new UserTagSectionHelper.Factory(\"envVar\", \"envVar\"))\n                .addSectionHelper(new UserTagSectionHelper.Factory(\"durationNote\", \"durationNote\"))\n                .addSectionHelper(new UserTagSectionHelper.Factory(\"memorySizeNote\", \"memorySizeNote\"))\n                .addValueResolver(new ReflectionValueResolver())\n                .addValueResolver(ValueResolver.builder()\n                        .applyToBaseClass(String.class)\n                        .applyToName(\"escapeCellContent\")\n                        .applyToNoParameters()\n                        .resolveSync(ctx -> formatter.escapeCellContent((String) ctx.getBase()))","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateConfigDocMojo.java#L293-L329","documentation":"findTargetDirectories walks the scan directory looking for extension target directories; any IOException during that walk is wrapped in a MojoExecutionException 'Unable to collect the target directories'. This happens before any generation work starts.","triggerScenarios":"findTargetDirectories (invoked via targetDirectories) cannot traverse scanDirectory — it does not exist, lacks read permission, or an I/O error occurs during Files.walk/DirectoryStream iteration.","commonSituations":"Running the plugin outside a Quarkus multi-module checkout so the scan directory is missing; CI checkouts with restricted permissions; symlink loops or deleted directories mid-scan.","solutions":["Verify the configured scanDirectory exists and is readable","Run the plugin from the repository root of a Quarkus extensions checkout","Check directory permissions and remove broken symlinks before retrying"],"exampleFix":"// before (dir missing)\nmvn quarkus:generate-config-doc -DscanDirectory=./missing-extensions\n// after\nmvn quarkus:generate-config-doc -DscanDirectory=${project.basedir}/extensions","handlingStrategy":"validation","validationCode":"Path scan = Paths.get(scanDirectory);\nif (!Files.isDirectory(scan) || !Files.isReadable(scan)) {\n    throw new IllegalStateException(\"Invalid scanDirectory: \" + scan);\n}","typeGuard":null,"tryCatchPattern":"try {\n    mojo.execute();\n} catch (MojoExecutionException e) {\n    if (e.getMessage().contains(\"Unable to collect the target directories\")) {\n        logger.error(\"Check scanDirectory exists and is readable\", e.getCause());\n    }\n}","preventionTips":["Run the plugin from the repo root of a full Quarkus checkout","Avoid broken symlinks in scanned trees","Verify CI checkout completeness before doc generation"],"tags":["maven","filesystem","io"],"backgroundTag":"directory-not-found","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"}