{"record":{"id":"dbf010ebbe2ae440","repo":"quarkusio/quarkus","slug":"multiple-selection-for-base-codestart-of-type","errorCode":null,"errorMessage":"Multiple selection for base codestart of type: '\" + a.getSpec().getType() + \"' that should be unique. Only one of '\" + a.getSpec().getName() + \"' and '\" + b.getSpec().getName() + \"' should be selected at once.","messagePattern":"Multiple selection for base codestart of type: '\" \\+ a\\.getSpec\\(\\)\\.getType\\(\\) \\+ \"' that should be unique\\. Only one of '\" \\+ a\\.getSpec\\(\\)\\.getName\\(\\) \\+ \"' and '\" \\+ b\\.getSpec\\(\\)\\.getName\\(\\) \\+ \"' should be selected at once\\.","errorType":"exception","errorClass":"CodestartException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartCatalogs.java","lineNumber":68,"sourceCode":"            }\n            return true;\n        }).collect(Collectors.toList());\n    }\n\n    static Collection<Codestart> getBaseSelection(Collection<Codestart> codestarts, Set<String> selection) {\n        return codestarts.stream()\n                .filter(c -> c.getSpec().getType().isBase())\n                .filter(c -> c.getSpec().isFallback() || c.isSelected(selection))\n                .collect(Collectors.toMap(c -> c.getSpec().getType(), c -> c, (a, b) -> {\n                    // When there is multiple matches for one key, one should be selected and the other a fallback.\n                    if (a.getSpec().isFallback() && b.getSpec().isFallback()) {\n                        throw new CodestartStructureException(\n                                \"Multiple fallback found for a base codestart of type: '\" + a.getSpec().getType()\n                                        + \"' that should be unique. Only one of '\" + a.getSpec().getName() + \"' and '\"\n                                        + b.getSpec().getName() + \"' should be a fallback\");\n                    }\n                    if (!a.getSpec().isFallback() && !b.getSpec().isFallback()) {\n                        throw new CodestartException(\n                                \"Multiple selection for base codestart of type: '\" + a.getSpec().getType()\n                                        + \"' that should be unique. Only one of '\" + a.getSpec().getName() + \"' and '\"\n                                        + b.getSpec().getName() + \"' should be selected at once.\");\n                    }\n                    // The selected is picked.\n                    return !a.getSpec().isFallback() ? a : b;\n                })).values();\n    }\n\n    static Collection<Codestart> getExtraSelection(Collection<Codestart> codestarts, Set<String> selection) {\n        return codestarts.stream()\n                .filter(c -> !c.getSpec().getType().isBase())\n                .filter(c -> c.getSpec().isPreselected() || c.isSelected(selection))\n                .collect(Collectors.toList());\n    }\n\n}\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartCatalogs.java#L50-L86","documentation":"CodestartCatalogs.getBaseSelection() throws CodestartException when two candidates for the same base codestart type are BOTH explicitly selected (neither is a fallback). Only one codestart per base type may be selected at a time; a fallback + selected pair is fine, two selections is not.","triggerScenarios":"Passing a selection (e.g. --codestart or project generation input) that names two codestarts of the same base type, so Collectors.toMap's merge finds two non-fallback matches.","commonSituations":"Specifying conflicting codestarts on the quarkus CLI / project creation (e.g. two config or two tooling codestarts of the same type); an extension metadata file listing a selected codestart that collides with a user selection.","solutions":["Deselect one of the two codestarts of that base type in the selection input.","Check extension codestart metadata for a codestart auto-selected with the same type as a user-provided one.","Use different types for codestarts that should be combined rather than being alternatives."],"exampleFix":"// before\nquarkus create app --codestart=config-yaml --codestart=config-properties ...\n// after\nquarkus create app --codestart=config-yaml ...","handlingStrategy":"validation","validationCode":"// dedupe selection by base type before calling select\nSet<String> seen = new HashSet<>();\nfor (var name : selectedNames) {\n    var type = catalog.typeOf(name);\n    if (type.isBase() && !seen.add(type)) throw new IllegalArgumentException(\"Multiple selected codestarts for type \" + type);\n}","typeGuard":null,"tryCatchPattern":"try {\n    var selected = CodestartCatalogs.select(catalogs, selection);\n} catch (CodestartException e) {\n    if (e.getMessage().contains(\"Multiple selection\")) {\n        logger.error(\"Two selected codestarts share a base type — remove one from the selection\");\n    }\n    throw e;\n}","preventionTips":["Allow at most one selected codestart per base type in CLI/UI inputs.","Check extension-provided codestarts for auto-selection conflicts.","Use fallback flags for alternatives instead of multiple selections."],"tags":["codestart","selection-conflict","duplicate","cli"],"backgroundTag":"duplicate-codestart-selection","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"}