spring-projects/spring-boot · error · ReportableException

Initializr service call failed using '{}' - service returned

Error message

Initializr service call failed using '{}' - service returned {}

What it means

Thrown by InitializrService.createException when the HTTP response status code is not 200. The message includes the URL, the status reason phrase, and if the body is JSON with a 'message' field, the server's error text; otherwise it reports the unexpected numeric status code.

Source

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

		catch (IOException ex) {
			throw new ReportableException(
					"Failed to " + description + " from service at '" + url + "' (" + ex.getMessage() + ")");
		}
	}

	private ReportableException createException(String url, ClassicHttpResponse httpResponse) {
		StatusLine statusLine = new StatusLine(httpResponse);
		String message = "Initializr service call failed using '" + url + "' - service returned "
				+ statusLine.getReasonPhrase();
		String error = extractMessage(httpResponse.getEntity());
		if (StringUtils.hasText(error)) {
			message += ": '" + error + "'";
		}
		else {
			int statusCode = statusLine.getStatusCode();
			message += " (unexpected " + statusCode + " error)";
		}
		throw new ReportableException(message);
	}

	private @Nullable String extractMessage(@Nullable HttpEntity entity) {
		if (entity != null) {
			try {
				JSONObject error = getContentAsJson(entity);
				if (error.has("message")) {
					return error.getString("message");
				}
			}
			catch (Exception ex) {
				// Ignore
			}
		}
		return null;
	}

	private JSONObject getContentAsJson(HttpEntity entity) throws IOException, JSONException {

View on GitHub (pinned to 270dfe353f)

Solutions

  1. Run 'spring init --list' to see supported capabilities
  2. Adjust bootVersion, javaVersion, and type to values the server supports
  3. If 5xx, retry later or contact the service operator
  4. If 429, back off and retry after a delay

Example fix

// before
$ spring init --bootVersion 1.0.0.RELEASE
// after
$ spring init --bootVersion 3.2.0  # a version the server supports
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate parameters against server capabilities first.
InitializrServiceMetadata md = service.loadMetadata(serviceUrl);
if (!md.getProjectTypes().containsKey(request.getType())) {
    throw new IllegalArgumentException("Unsupported type; run --list");
}
// This prevents the most common 4xx from reaching createException().

Try / catch

try {
    service.generateProject(request);
} catch (ReportableException ex) {
    String m = ex.getMessage();
    if (m.startsWith("Initializr service call failed")) {
        Log.error("Server rejected the request: " + m + " - check --list for supported values");
    }
    throw ex;
}

Prevention

When it happens

Trigger: Server returns 4xx (bad request, e.g. an unsupported bootVersion/javaVersion combination) or 5xx (server error). Also rate limiting (429).

Common situations: Requesting a project type, Java version, or Spring Boot version the server does not support; the Initializr service is misconfigured or failing; being rate-limited.

Related errors


AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11). Data as JSON: /api/errors/33a82b8c7dd12e2a. Report an issue: GitHub.