spring-projects/spring-boot · error · ReportableException

No project type with id '${this.type}' - check the service c

Error message

No project type with id '${this.type}' - check the service capabilities (--list)

What it means

Thrown by ProjectGenerationRequest.determineProjectType when the caller has explicitly set a project type id (via --type) but that id does not exist among the project types advertised by the Initializr service (start.spring.io or a custom --target). The library refuses to guess because the type id drives the generation endpoint path (projectType.getAction()) and a wrong id would produce a meaningless request.

Source

Thrown at cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java:368

			if (this.language != null) {
				builder.setParameter("language", this.language);
			}
			if (this.bootVersion != null) {
				builder.setParameter("bootVersion", this.bootVersion);
			}

			return builder.build();
		}
		catch (URISyntaxException ex) {
			throw new ReportableException("Invalid service URL (" + ex.getMessage() + ")");
		}
	}

	protected ProjectType determineProjectType(InitializrServiceMetadata metadata) {
		if (this.type != null) {
			ProjectType result = metadata.getProjectTypes().get(this.type);
			if (result == null) {
				throw new ReportableException(
						("No project type with id '" + this.type + "' - check the service capabilities (--list)"));
			}
			return result;
		}
		else if (isDetectType()) {
			Map<String, ProjectType> types = new HashMap<>(metadata.getProjectTypes());
			if (this.build != null) {
				filter(types, "build", this.build);
			}
			if (this.format != null) {
				filter(types, "format", this.format);
			}
			if (types.size() == 1) {
				return types.values().iterator().next();
			}
			else if (types.isEmpty()) {
				throw new ReportableException("No type found with build '" + this.build + "' and format '" + this.format
						+ "' check the service capabilities (--list)");

View on GitHub (pinned to 5b2dbdbb8b)

Solutions

  1. Run `spring init --list` (or query the service metadata) and copy the exact 'id' of the desired type from the printed capabilities.
  2. Remove the --type flag to let the CLI auto-detect the type from --build and --format, or fall back to the service default.
  3. If using a custom service, point --target at one whose capabilities actually include the type you need, and confirm the service version.

Example fix

// before
$ spring init --type mavenproject myapp
// after
$ spring init --list   # copy exact id, e.g. 'maven-project'
$ spring init --type maven-project myapp
Defensive patterns

Strategy: validation

Validate before calling

InitializrServiceMetadata md = InitializrServiceMetadata.forService(request.getServiceUrl());
if (request.getType() != null && !md.getProjectTypes().containsKey(request.getType())) {
    throw new IllegalArgumentException(
        "Unknown type '" + request.getType() + "'. Available: " + md.getProjectTypes().keySet());
}

Type guard

// Java: prefer the typed ProjectType lookup rather than a raw id string
ProjectType t = (request.getType() != null)
    ? metadata.getProjectTypes().get(request.getType())
    : null;
if (request.getType() != null && t == null) {
    // reject before generateUrl()
}

Try / catch

try {
    URI u = request.generateUrl(metadata);
} catch (ReportableException ex) {
    if (ex.getMessage().contains("No project type with id")) {
        // prompt user to run --list and supply a valid --type
    } else throw ex;
}

Prevention

When it happens

Trigger: Calling `spring init --type <id>` (or programmatically request.setType(id)) where <id> is not a key in InitializrServiceMetadata.getProjectTypes(). Common when the id is misspelled, uses the wrong case, or was renamed/removed in a newer service version.

Common situations: Switching the target Initializr instance (e.g. an older internal start server) that advertises a different set of type ids; upgrading Spring Boot CLI against a service that renamed a type (e.g. 'maven-project' vs 'maven-build'); copy-pasting a --type value from an outdated tutorial.

Related errors


AI-assisted analysis of spring-projects/spring-boot@5b2dbdbb8b (2026-08-04). Data as JSON: /data/errors/8990c4e8c8cb0445.json. Report an issue: GitHub.