spring-projects/spring-boot · error · IllegalArgumentException
Failed to parse arguments [{arguments}]
Error message
Failed to parse arguments [{arguments}] What it means
RunArguments.parseArgs converts a free-form argument string (e.g. the spring-boot.run.arguments Maven property) into a String[]. It normalizes newlines/tabs to spaces and delegates to Maven's CommandLineUtils.translateCommandline, which tokenizes with quote/backslash awareness. If the tokenizer encounters malformed syntax (unclosed quote, dangling escape), the exception is wrapped and rethrown as IllegalArgumentException with the offending arguments embedded in the message.
Source
Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java:73
Deque<String> getArgs() {
return this.args;
}
String[] asArray() {
return this.args.toArray(new String[0]);
}
static String[] parseArgs(@Nullable String arguments) {
if (arguments == null || arguments.trim().isEmpty()) {
return NO_ARGS;
}
try {
arguments = arguments.replace('\n', ' ').replace('\t', ' ');
return CommandLineUtils.translateCommandline(arguments);
}
catch (Exception ex) {
throw new IllegalArgumentException("Failed to parse arguments [" + arguments + "]", ex);
}
}
}
View on GitHub (pinned to 270dfe353f)
Solutions
- Quote any argument containing spaces: -Dspring-boot.run.arguments="--greeting='hello world' --port=8080"
- Pass each argument as its own space-separated token and use single quotes around values that contain spaces
- Move complex values into a Maven property and reference them with ${property.name} rather than inlining
Example fix
// before -Dspring-boot.run.arguments=--greeting=hello world // after -Dspring-boot.run.arguments="--greeting=hello world"
Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate argument string the same way the plugin will
try {
org.codehaus.plexus.util.cli.CommandLineUtils.translateCommandline(arguments);
} catch (Exception e) {
throw new IllegalArgumentException("Arguments would fail to parse: " + e.getMessage(), e);
} Try / catch
try { RunArguments.parseArgs(args); } catch (IllegalArgumentException ex) { log.error("Malformed run arguments; check quoting: {}", args); throw ex; } Prevention
- Always quote arguments that contain spaces
- Use Maven properties instead of inlining complex argument values
- Run mvn with -X to see the translated argument array before relying on it
When it happens
Trigger: Setting spring-boot.run.arguments (or jvmArguments) to a value with an unmatched quote, an odd number of backslashes, or otherwise unbalanced quoting that CommandLineUtils.translateCommandline rejects.
Common situations: Passing an argument containing spaces without quoting (e.g. --greeting=hello world splits into two tokens); embedding JSON or paths with spaces; copy-pasting values from a shell that already consumed the surrounding quotes.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to load layers configuration with name '%s': '%s' not
- Failed to generate build-info.properties. {ex.getMessage()}
- Invalid Docker configuration, either context or host can be
- '%s' is not within the valid range %s to %s
- Invalid jmx name '{name}'
AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11).
Data as JSON: /api/errors/14465e905456048c.
Report an issue: GitHub.