jenkinsci/jenkins · error · CmdLineException
No default value for the parameter '%s'.
Error message
No default value for the parameter '%s'.
What it means
Thrown as a CmdLineException when iterating over the job's ParameterDefinitions and finding one that was not provided via -p AND has no default value (getDefaultParameterValue() returns null). This ensures all required parameters receive a value before the build is scheduled.
Source
Thrown at core/src/main/java/hudson/cli/BuildCommand.java:137
String.format("'%s' is not a valid parameter.", name) :
String.format("'%s' is not a valid parameter. Did you mean %s?", name, nearest));
}
ParameterValue val = pd.createValue(this, Util.fixNull(e.getValue()));
if (val == null) {
throw new CmdLineException(null, String.format("Cannot resolve the value for the parameter '%s'.", name));
}
values.add(val);
}
// handle missing parameters by adding as default values ISSUE JENKINS-7162
for (ParameterDefinition pd : pdp.getParameterDefinitions()) {
if (parameters.containsKey(pd.getName()))
continue;
// not passed in use default
ParameterValue defaultValue = pd.getDefaultParameterValue();
if (defaultValue == null) {
throw new CmdLineException(null, String.format("No default value for the parameter '%s'.", pd.getName()));
}
values.add(defaultValue);
}
a = new ParametersAction(values);
}
if (checkSCM) {
SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job);
if (item == null)
throw new AbortException(job.getFullDisplayName() + " has no SCM trigger, but checkSCM was specified");
// preemptively check for a polling veto
if (SCMDecisionHandler.firstShouldPollVeto(job) != null) {
return 0;
}
if (!item.poll(new StreamTaskListener(stdout, getClientCharset())).hasChanges())
return 0;
}View on GitHub (pinned to 2e228ff40b)
Solutions
- Provide the missing parameter via -p <name>=<value> in the CLI command.
- Set a default value for the parameter in the job configuration so it is optional.
- List all required parameters: check the job configuration for parameters without defaults.
Defensive patterns
Strategy: validation
Validate before calling
// Check all required parameters are provided
ParametersDefinitionProperty pdp = job.getProperty(ParametersDefinitionProperty.class);
if (pdp != null) {
for (ParameterDefinition pd : pdp.getParameterDefinitions()) {
if (!parameters.containsKey(pd.getName()) && pd.getDefaultParameterValue() == null) {
throw new AbortException("Required parameter '" + pd.getName() + "' was not provided and has no default.");
}
}
} Type guard
public static boolean isParameterRequired(ParameterDefinition pd) {
return pd.getDefaultParameterValue() == null;
} Try / catch
try {
// build command run()
} catch (CmdLineException e) {
if (e.getMessage().contains("No default value")) {
stderr.println(e.getMessage());
stderr.println("Provide the missing parameter with -p <name>=<value>.");
return 1;
}
throw e;
} Prevention
- List all required parameters (those without defaults) before constructing the build command.
- Set default values for optional parameters to avoid this error.
- Use a parameter validation step in CI scripts to catch missing required parameters early.
When it happens
Trigger: During the 'fill in defaults' loop: a ParameterDefinition is not in the provided parameters map (parameters.containsKey(pd.getName()) is false), and pd.getDefaultParameterValue() returns null.
Common situations: A required parameter was added to the job but not supplied in the CLI call; a parameter definition's default value was cleared or never set; a custom ParameterDefinition type that doesn't implement getDefaultParameterValue properly.
Related errors
- '%s' is not a valid parameter.
- '%s' is not a valid parameter. Did you mean %s?
- Cannot resolve the value for the parameter '%s'.
- {} is not parameterized but the -p option was specified.
- {} has no SCM trigger, but checkSCM was specified
AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14).
Data as JSON: /api/errors/9c05a9f0ce2b7281.
Report an issue: GitHub.