{"record":{"id":"ef4e15ce62e5a2b6","repo":"apache/maven","slug":"unable-to-verify-file-existence-for-glob-insi","errorCode":null,"errorMessage":"Unable to verify file existence for '${glob}' inside '${fixedPath}'","messagePattern":"Unable to verify file existence for '(.+?)' inside '(.+?)'","errorType":"exception","errorClass":"ProjectBuilderException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultProfileActivationContext.java","lineNumber":454,"sourceCode":"            return false;\n        }\n        if (glob != null && !glob.isEmpty()) {\n            try {\n                PathMatcher matcher = fixedPath.getFileSystem().getPathMatcher(\"glob:\" + glob);\n                AtomicBoolean found = new AtomicBoolean(false);\n                Files.walkFileTree(fixedPath, new SimpleFileVisitor<>() {\n                    @Override\n                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {\n                        if (found.get() || matcher.matches(fixedPath.relativize(file))) {\n                            found.set(true);\n                            return FileVisitResult.TERMINATE;\n                        }\n                        return FileVisitResult.CONTINUE;\n                    }\n                });\n                return found.get();\n            } catch (IOException e) {\n                throw new ProjectBuilderException(\n                        \"Unable to verify file existence for '\" + glob + \"' inside '\" + fixedPath + \"'\", e);\n            }\n        }\n        return true;\n    }\n\n    private static Map<String, String> unmodifiable(Map<String, String> map) {\n        return map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap();\n    }\n}\n","sourceCodeStart":436,"sourceCodeEnd":465,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultProfileActivationContext.java#L436-L465","documentation":"When a profile activation file check uses a wildcard (e.g. exists('src/**/*.java') or a <file exists=\"dir/*.xml\"/> tag), DefaultProfileActivationContext splits the pattern into a fixed directory plus a glob and walks the tree with Files.walkFileTree. Any IOException during the walk (permission denied, unreadable entry, IO error) is wrapped in ProjectBuilderException with this message.","triggerScenarios":"An activation condition whose fixed prefix directory exists but cannot be traversed: missing read/execute permission, restrictive ACL, read-only or corrupted mount, broken symlinks, or entries deleted while the walk is in progress.","commonSituations":"Hardened CI containers running as non-root; Docker volumes with unexpected ownership; NFS/SMB mounts; huge trees walked in parallel with cleanup jobs removing files.","solutions":["Check permissions on the directory named in the message (ls -ld) and fix ownership/permission bits so the build user can traverse it","Narrow the glob so it walks a small, readable subtree instead of the whole project","Replace wildcard checks with a plain file path when a single well-known file is enough","If the read-only environment is intentional, deactivate the profile (-P!profile) so activation never probes the tree"],"exampleFix":"<!-- before: walks the whole project tree -->\n<condition>exists('${project.basedir}/**/Dockerfile')</condition>\n\n<!-- after: single readable path (or a tight subtree) -->\n<condition>exists('${project.basedir}/Dockerfile')</condition>","handlingStrategy":"validation","validationCode":"static boolean canWalk(Path dir) {\n    return Files.isDirectory(dir) && Files.isReadable(dir);\n}\n// before evaluating a glob condition\nPath fixed = Path.of(pattern.substring(0, pattern.indexOf('*'))).getParent();\nif (fixed != null && !canWalk(fixed)) {\n    // treat the profile as not activatable instead of letting the walk fail\n}","typeGuard":null,"tryCatchPattern":"try {\n    boolean active = profileActivationContext.exists(globPath, true);\n} catch (ProjectBuilderException e) {\n    // underlying IOException: unreadable/locked tree; decide activation policy explicitly\n}","preventionTips":["Prefer plain file paths over wildcards in activation conditions; globs force a tree walk with real IO-failure surface","Keep activation-probed directories small and readable by the build user","In containers, verify volume permissions for any directory referenced by activation conditions"],"tags":["maven","profile-activation","file-system","permissions","glob"],"backgroundTag":"file-system-access-denied","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}