{"record":{"id":"5d606136fc0954fe","repo":"apache/maven","slug":"unknown-lifecycle-phase-you-must-specify-a-v","errorCode":null,"errorMessage":"Unknown lifecycle phase \"{}\". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: {}.","messagePattern":"Unknown lifecycle phase \"(.+?)\"\\. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>\\[:<plugin-version>\\]:<goal>\\. Available lifecycle phases are: (.+?)\\.","errorType":"exception","errorClass":"LifecyclePhaseNotFoundException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java","lineNumber":256,"sourceCode":"            } else {\n                throw new IllegalStateException(\"unexpected task \" + task);\n            }\n        }\n        return mojoExecutions;\n    }\n\n    private Map<String, List<MojoExecution>> calculateLifecycleMappings(\n            MavenSession session, MavenProject project, String lifecyclePhase)\n            throws LifecyclePhaseNotFoundException, PluginNotFoundException, PluginResolutionException,\n                    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException {\n        /*\n         * Determine the lifecycle that corresponds to the given phase.\n         */\n\n        Lifecycle lifecycle = defaultLifecycles.get(lifecyclePhase);\n\n        if (lifecycle == null) {\n            throw new LifecyclePhaseNotFoundException(\n                    \"Unknown lifecycle phase \\\"\" + lifecyclePhase\n                            + \"\\\". You must specify a valid lifecycle phase\"\n                            + \" or a goal in the format <plugin-prefix>:<goal> or\"\n                            + \" <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: \"\n                            + defaultLifecycles.getLifecyclePhaseList() + \".\",\n                    lifecyclePhase);\n        }\n\n        LifecycleMappingDelegate delegate;\n        if (List.of(DefaultLifecycles.STANDARD_LIFECYCLES).contains(lifecycle.getId())) {\n            delegate = standardDelegate;\n        } else {\n            delegate = delegates.getOrDefault(lifecycle.getId(), standardDelegate);\n        }\n\n        return delegate.calculateLifecycleMappings(session, project, lifecycle, lifecyclePhase);\n    }\n","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java#L238-L274","documentation":"DefaultLifecycleExecutionPlanCalculator.calculateLifecycleMappings() resolves each requested task to a lifecycle; if no known lifecycle contains the requested phase, it throws LifecyclePhaseNotFoundException with the full list of valid phase names. This is Maven's response to a task on the command line (or in a launched build) that is neither a valid phase nor a parseable plugin goal.","triggerScenarios":"Running e.g. 'mvn complie' (typo), 'mvn intall -DskipTests', or a custom phase name only defined by an extension whose lifecycle is not registered; also programmatic task segments that contain a bare, unknown word that is not recognized as <prefix>:<goal>.","commonSituations":"Typos in phase names ('packge', 'depoy', 'verifi'); using a phase from a custom lifecycle (e.g. from the Paxdoc or Tycho lifecycles) without the corresponding extension enabled; scripts assuming a phase exists in a different Maven packaging.","solutions":["Compare your phase against the 'Available lifecycle phases are:' list printed in the message — usually a typo","If you meant a plugin goal, use the full format <plugin-prefix>:<goal> or <groupId>:<artifactId>[:<version>]:<goal>","If the phase comes from a custom lifecycle, make sure the extension that defines it is loaded (build extension in the POM or ext= CLI arg)","Tab-complete or 'mvn help:describe' goals to verify names before scripting them"],"exampleFix":"# before\nmvn complie\n\n# after\nmvn compile","handlingStrategy":"validation","validationCode":"// before running tasks, check each phase name against known lifecycles\nSet<String> valid = defaultLifecycles.getLifeCycles().stream()\n    .flatMap(l -> l.getPhases().stream()).collect(Collectors.toSet());\nfor (String task : tasks) {\n    String phase = task.contains(\"@\") ? task.substring(0, task.indexOf('@')) : task;\n    if (!valid.contains(phase) && !phase.contains(\":\")) throw new IllegalArgumentException(\"Unknown phase: \" + phase);\n}","typeGuard":"boolean isValidPhaseOrGoal(String task, Set<String> phases) {\n    String phase = task.contains(\"@\") ? task.substring(0, task.indexOf('@')) : task;\n    return phases.contains(phase) || task.matches(\"[^\\s:]+:[^\\s:]+\") || task.matches(\"[^\\s:]+:[^\\s:]+(:[^\\s:]+)?:[^\\s:]+\");\n}","tryCatchPattern":"catch (LifecyclePhaseNotFoundException e) {\n    // e.getLifecyclePhase() is the offending name; compare with valid list and surface a typo hint\n}","preventionTips":["Validate goal names in scripts before invoking Maven","Load extensions that define custom lifecycles in the same project that uses their phases","Use 'mvn help:describe' to confirm plugin prefix/goal pairs"],"tags":["maven","lifecycle","phase","cli","typo"],"backgroundTag":"unknown-lifecycle-phase","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}