spring-projects/spring-boot · error · ReportableException

No content received from server '{}'

Error message

No content received from server '{}'

What it means

Thrown by InitializrService.validateResponse when httpResponse.getEntity() is null. The check runs before the status-code check, so any response with no body (even a 200) triggers it. The message names the service URL so the failing endpoint is identifiable.

Source

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

		ContentType contentType = ContentType.create(httpEntity.getContentType());
		if (contentType.getMimeType().equals("text/plain")) {
			return getContent(httpEntity);
		}
		return parseJsonMetadata(httpEntity);
	}

	private InitializrServiceMetadata parseJsonMetadata(HttpEntity httpEntity) throws IOException {
		try {
			return new InitializrServiceMetadata(getContentAsJson(httpEntity));
		}
		catch (JSONException ex) {
			throw new ReportableException("Invalid content received from server (" + ex.getMessage() + ")", ex);
		}
	}

	private void validateResponse(ClassicHttpResponse httpResponse, String serviceUrl) {
		if (httpResponse.getEntity() == null) {
			throw new ReportableException("No content received from server '" + serviceUrl + "'");
		}
		if (httpResponse.getCode() != 200) {
			throw createException(serviceUrl, httpResponse);
		}
	}

	private ProjectGenerationResponse createResponse(ClassicHttpResponse httpResponse, HttpEntity httpEntity)
			throws IOException {
		ProjectGenerationResponse response = new ProjectGenerationResponse(
				ContentType.create(httpEntity.getContentType()));
		response.setContent(FileCopyUtils.copyToByteArray(httpEntity.getContent()));
		String fileName = extractFileName(httpResponse.getFirstHeader("Content-Disposition"));
		if (fileName != null) {
			response.setFileName(fileName);
		}
		return response;
	}

View on GitHub (pinned to 270dfe353f)

Solutions

  1. Confirm the --target URL endpoint path is correct
  2. Test the endpoint with curl to verify it returns a body
  3. Verify no proxy is stripping response bodies
  4. Retry; may be transient under heavy server load
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight with curl/plain HTTP client: assert the response has a non-empty body.
// GET <serviceUrl>  -> expect Content-Length > 0 and a parseable body.

Try / catch

try {
    service.generateProject(request);
} catch (ReportableException ex) {
    if (ex.getMessage().startsWith("No content received from server")) {
        Log.error("Endpoint returned an empty body; check the URL/proxy: " + serviceUrl);
    }
    throw ex;
}

Prevention

When it happens

Trigger: The Initializr endpoint returns a response with a null entity (empty body), e.g. a server misconfiguration returning an empty 200, or an intermediary that drops the body.

Common situations: Server under load returning truncated responses; a reverse proxy misconfigured to strip the body; the wrong endpoint path returning an empty response.

Related errors


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