{"record":{"id":"8489329f8d89d83d","repo":"apache/maven","slug":"invalid-reactor-make-behavior","errorCode":null,"errorMessage":"Invalid reactor make behavior: {}","messagePattern":"Invalid reactor make behavior: (.+?)","errorType":"exception","errorClass":"MavenExecutionException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java","lineNumber":275,"sourceCode":"            }\n        }\n\n        return result;\n    }\n\n    private List<MavenProject> includeAlsoMakeTransitively(\n            List<MavenProject> projects, MavenExecutionRequest request, ProjectDependencyGraph graph)\n            throws MavenExecutionException {\n        List<MavenProject> result = projects;\n\n        String makeBehavior = request.getMakeBehavior();\n        boolean makeBoth = MavenExecutionRequest.REACTOR_MAKE_BOTH.equals(makeBehavior);\n\n        boolean makeUpstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals(makeBehavior);\n        boolean makeDownstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals(makeBehavior);\n\n        if ((makeBehavior != null && !makeBehavior.isEmpty()) && !makeUpstream && !makeDownstream) {\n            throw new MavenExecutionException(\"Invalid reactor make behavior: \" + makeBehavior, request.getPom());\n        }\n\n        if (makeUpstream || makeDownstream) {\n            Set<MavenProject> projectsSet = new HashSet<>(projects);\n\n            for (MavenProject project : projects) {\n                if (makeUpstream) {\n                    projectsSet.addAll(graph.getUpstreamProjects(project, true));\n                }\n                if (makeDownstream) {\n                    projectsSet.addAll(graph.getDownstreamProjects(project, true));\n                }\n            }\n\n            result = new ArrayList<>(projectsSet);\n\n            // Order the new list in the original order\n            List<MavenProject> sortedProjects = graph.getSortedProjects();","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java#L257-L293","documentation":"MavenExecutionException thrown when MavenExecutionRequest.getMakeBehavior() returns a non-empty string that is neither 'upstream' (-am), 'downstream' (-amd), nor 'upstream-downstream' (both). The Maven CLI only ever produces valid values, so this error almost always comes from code embedding Maven and setting the field directly.","triggerScenarios":"Programmatic request.setMakeBehavior(\"also-make\") or any invented value; embedders/launchers translating CLI flag names into the field instead of using the defined constants; custom request populators copying raw strings.","commonSituations":"IDE bootstrap code, maven-invoker-based tools, or tests building MavenExecutionRequest by hand and guessing the make-behavior vocabulary.","solutions":["Use the constants: MavenExecutionRequest.REACTOR_MAKE_UPSTREAM ('upstream'), REACTOR_MAKE_DOWNSTREAM ('downstream'), REACTOR_MAKE_BOTH ('upstream-downstream'), or null/empty string to disable","Map -am to 'upstream', -amd to 'downstream', -am -amd together to 'upstream-downstream'"],"exampleFix":"// before\nrequest.setMakeBehavior(\"also-make\"); // Invalid reactor make behavior\n\n// after\nrequest.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_UPSTREAM);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static boolean isValidMakeBehavior(String makeBehavior) {\n    if (makeBehavior == null || makeBehavior.isEmpty()) return true; // disabled\n    return makeBehavior.equals(MavenExecutionRequest.REACTOR_MAKE_UPSTREAM)\n        || makeBehavior.equals(MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM)\n        || makeBehavior.equals(MavenExecutionRequest.REACTOR_MAKE_BOTH);\n}","tryCatchPattern":null,"preventionTips":["Embedders must use the REACTOR_MAKE_* constants, never raw flag names","Guard request-building code with the validator above and fail early with the valid values listed"],"tags":["maven","reactor","make-behavior","embedder","validation"],"backgroundTag":"invalid-option-value","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}