spring-projects/spring-boot · error · ReportableException
Could not save the project, the server did not set a…
Error message
Could not save the project, the server did not set a preferred file name and no location was set. Specify the output location for the project.
What it means
Thrown by ProjectGenerator.generateProject when no output file name can be determined: the response was not a zip to extract (or was not extractable), the server set no Content-Disposition preferred file name, and the user supplied no --output location. With nothing to write to, generation aborts.
Solutions
- Pass --output with an explicit file path and name
- Verify the service returns a Content-Disposition header
- Ensure the requested type/format yields a zip if you expect extraction
Example fix
// before $ spring init // after $ spring init --output myapp.zip
Defensive patterns
Strategy: validation
Validate before calling
// Ensure an output location is set before generating.
if (request.getOutput() == null) {
request.setOutput("project.zip"); // explicit fallback name
}
// Also sanity-check the response has a content type you can handle. Try / catch
try {
generator.generateProject(request, force);
} catch (ReportableException ex) {
if (ex.getMessage().startsWith("Could not save the project")) {
Log.error("No output file name - rerun with --output <path>");
}
throw ex;
} Prevention
- Always pass --output in automation so file naming does not depend on the server
- Verify the service returns a Content-Disposition header for non-zip responses
- Prefer zip-extractable types so the file name is not required
When it happens
Trigger: Server returns a non-zip content type with no Content-Disposition header and the user did not pass --output.
Common situations: Server misconfiguration dropping the Content-Disposition header; a non-standard Initializr endpoint; a request whose type/format yields a non-archive response.
Related errors
- ' ' already exists. Use --force if you want to overwrite or…
- File ' ' already exists. Use --force if you want to…
- No project type is set and no default is defined. Check the…
- Failed to delete existing file
- Invalid service URL ( )
AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11).
Data as JSON: /api/errors/abb02e3dca28e29c.
Report an issue: GitHub.
Appendix: source
Thrown at cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java:63
this.initializrService = initializrService;
}
void generateProject(ProjectGenerationRequest request, boolean force) throws IOException {
ProjectGenerationResponse response = this.initializrService.generate(request);
String fileName = (request.getOutput() != null) ? request.getOutput() : response.getFileName();
if (shouldExtract(request, response)) {
if (isZipArchive(response)) {
extractProject(response, request.getOutput(), force);
return;
}
else {
Log.info("Could not extract '" + response.getContentType() + "'");
// Use value from the server since we can't extract it
fileName = response.getFileName();
}
}
if (fileName == null) {
throw new ReportableException("Could not save the project, the server did not set a preferred "
+ "file name and no location was set. Specify the output location for the project.");
}
writeProject(response, fileName, force);
}
/**
* Detect if the project should be extracted.
* @param request the generation request
* @param response the generation response
* @return if the project should be extracted
*/
private boolean shouldExtract(ProjectGenerationRequest request, ProjectGenerationResponse response) {
if (request.isExtract()) {
return true;
}
// explicit name hasn't been provided for an archive and there is no extension
return isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".");
}View on GitHub (pinned to 270dfe353f)