quarkusio/quarkus · error · CodestartException

Multiple selection for base codestart of type: '" + a.getSpe

Error message

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.

What it means

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.

Source

Thrown at independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/CodestartCatalogs.java:68

            }
            return true;
        }).collect(Collectors.toList());
    }

    static Collection<Codestart> getBaseSelection(Collection<Codestart> codestarts, Set<String> selection) {
        return codestarts.stream()
                .filter(c -> c.getSpec().getType().isBase())
                .filter(c -> c.getSpec().isFallback() || c.isSelected(selection))
                .collect(Collectors.toMap(c -> c.getSpec().getType(), c -> c, (a, b) -> {
                    // When there is multiple matches for one key, one should be selected and the other a fallback.
                    if (a.getSpec().isFallback() && b.getSpec().isFallback()) {
                        throw new CodestartStructureException(
                                "Multiple fallback found for a base codestart of type: '" + a.getSpec().getType()
                                        + "' that should be unique. Only one of '" + a.getSpec().getName() + "' and '"
                                        + b.getSpec().getName() + "' should be a fallback");
                    }
                    if (!a.getSpec().isFallback() && !b.getSpec().isFallback()) {
                        throw new CodestartException(
                                "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.");
                    }
                    // The selected is picked.
                    return !a.getSpec().isFallback() ? a : b;
                })).values();
    }

    static Collection<Codestart> getExtraSelection(Collection<Codestart> codestarts, Set<String> selection) {
        return codestarts.stream()
                .filter(c -> !c.getSpec().getType().isBase())
                .filter(c -> c.getSpec().isPreselected() || c.isSelected(selection))
                .collect(Collectors.toList());
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Deselect one of the two codestarts of that base type in the selection input.
  2. Check extension codestart metadata for a codestart auto-selected with the same type as a user-provided one.
  3. Use different types for codestarts that should be combined rather than being alternatives.

Example fix

// before
quarkus create app --codestart=config-yaml --codestart=config-properties ...
// after
quarkus create app --codestart=config-yaml ...
Defensive patterns

Strategy: validation

Validate before calling

// dedupe selection by base type before calling select
Set<String> seen = new HashSet<>();
for (var name : selectedNames) {
    var type = catalog.typeOf(name);
    if (type.isBase() && !seen.add(type)) throw new IllegalArgumentException("Multiple selected codestarts for type " + type);
}

Try / catch

try {
    var selected = CodestartCatalogs.select(catalogs, selection);
} catch (CodestartException e) {
    if (e.getMessage().contains("Multiple selection")) {
        logger.error("Two selected codestarts share a base type — remove one from the selection");
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/dbf010ebbe2ae440. Report an issue: GitHub.