{"record":{"id":"073589befaad165d","repo":"apache/maven","slug":"not-a-regular-file-path","errorCode":null,"errorMessage":"Not a regular file: ${path}","messagePattern":"Not a regular file: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java","lineNumber":427,"sourceCode":"\n        public Model getRawModel(Path from, String groupId, String artifactId) {\n            ModelSource source = getSource(groupId, artifactId);\n            if (source != null) {\n                if (addEdge(from, source.getPath())) {\n                    return null;\n                }\n                try {\n                    return derive(source).readRawModel();\n                } catch (ModelBuilderException e) {\n                    // gathered with problem collector\n                }\n            }\n            return null;\n        }\n\n        public Model getRawModel(Path from, Path path) {\n            if (!Files.isRegularFile(path)) {\n                throw new IllegalArgumentException(\"Not a regular file: \" + path);\n            }\n            if (addEdge(from, path)) {\n                return null;\n            }\n            try {\n                return derive(Sources.buildSource(path)).readRawModel();\n            } catch (ModelBuilderException e) {\n                // gathered with problem collector\n            }\n            return null;\n        }\n\n        /**\n         * Returns false if the edge was added, true if it caused a cycle.\n         */\n        private boolean addEdge(Path from, Path p) {\n            try {\n                dag.addEdge(from.toString(), p.toString());","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java#L409-L445","documentation":"ModelBuilder.getRawModel(Path from, Path path) reads a raw (uninherited) model from a file-system path. Before reading, it requires Files.isRegularFile(path): a directory, a missing file, a dangling symlink, or a special file (FIFO/device) is rejected with IllegalArgumentException instead of a confusing read error.","triggerScenarios":"A <parent><relativePath> that resolves to a directory instead of a pom file; calling getRawModel(from, path) with a directory path; a symlinked module whose target has been moved or deleted.","commonSituations":"relativePath set to '..' or to a module directory rather than '../pom.xml'; scripts or embedders passing <dir>/some-module instead of <dir>/some-module/pom.xml; files moved/deleted while an IDE or daemon still holds stale paths.","solutions":["Set <relativePath> to the actual pom file (e.g. ../pom.xml) or remove the element so the default ../pom.xml lookup applies","Verify the file exists and is a regular file (ls -l) and fix symlinks","If calling getRawModel directly, guard the call with Files.isRegularFile(path)","Refresh/re-import the project in the IDE so stale paths are re-resolved"],"exampleFix":"<!-- before -->\n<parent>\n  <groupId>com.acme</groupId>\n  <artifactId>parent</artifactId>\n  <relativePath>../some-module</relativePath>\n</parent>\n\n<!-- after -->\n<parent>\n  <groupId>com.acme</groupId>\n  <artifactId>parent</artifactId>\n  <relativePath>../pom.xml</relativePath>\n</parent>","handlingStrategy":"validation","validationCode":"if (path == null || !Files.isRegularFile(path)) {\n    // skip or report instead of calling getRawModel(from, path)\n    throw new IllegalArgumentException(\"Pom path is not a regular file: \" + path);\n}\nModel raw = modelBuilder.getRawModel(from, path);","typeGuard":null,"tryCatchPattern":"try {\n    Model raw = modelBuilder.getRawModel(from, path);\n} catch (IllegalArgumentException e) {\n    // path was a directory / missing / dangling symlink; recompute or skip\n}","preventionTips":["Resolve relativePath values to an actual pom file and verify with Files.isRegularFile before use","Treat a null/missing pom as 'no parent here' rather than feeding the path into the builder","In long-lived tooling, re-stat paths before each read to catch files moved or deleted underneath you"],"tags":["maven","model-building","file-system","relative-path"],"backgroundTag":"invalid-file-path","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}