{"record":{"id":"40d529e764a7588d","repo":"jenkinsci/jenkins","slug":"cannot-resolve-the-value-for-the-parameter-s","errorCode":null,"errorMessage":"Cannot resolve the value for the parameter '%s'.","messagePattern":"Cannot resolve the value for the parameter '(.+?)'\\.","errorType":"validation","errorClass":"CmdLineException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/cli/BuildCommand.java","lineNumber":124,"sourceCode":"            ParametersDefinitionProperty pdp = job.getProperty(ParametersDefinitionProperty.class);\n            if (pdp == null)\n                throw new IllegalStateException(job.getFullDisplayName() + \" is not parameterized but the -p option was specified.\");\n\n            //TODO: switch to type annotations after the migration to Java 1.8\n            List<ParameterValue> values = new ArrayList<>();\n\n            for (Map.Entry<String, String> e : parameters.entrySet()) {\n                String name = e.getKey();\n                ParameterDefinition pd = pdp.getParameterDefinition(name);\n                if (pd == null) {\n                    String nearest = EditDistance.findNearest(name, pdp.getParameterDefinitionNames());\n                    throw new CmdLineException(null, nearest == null ?\n                            String.format(\"'%s' is not a valid parameter.\", name) :\n                            String.format(\"'%s' is not a valid parameter. Did you mean %s?\", name, nearest));\n                }\n                ParameterValue val = pd.createValue(this, Util.fixNull(e.getValue()));\n                if (val == null) {\n                    throw new CmdLineException(null, String.format(\"Cannot resolve the value for the parameter '%s'.\", name));\n                }\n                values.add(val);\n            }\n\n            // handle missing parameters by adding as default values ISSUE JENKINS-7162\n            for (ParameterDefinition pd : pdp.getParameterDefinitions()) {\n                if (parameters.containsKey(pd.getName()))\n                    continue;\n\n                // not passed in use default\n                ParameterValue defaultValue = pd.getDefaultParameterValue();\n                if (defaultValue == null) {\n                    throw new CmdLineException(null, String.format(\"No default value for the parameter '%s'.\", pd.getName()));\n                }\n                values.add(defaultValue);\n            }\n\n            a = new ParametersAction(values);","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/cli/BuildCommand.java#L106-L142","documentation":"Thrown as a CmdLineException when a ParameterDefinition.createValue(StaplerRequest, String) returns null for the given value string. This means the parameter definition recognized its name but could not parse/resolve the provided value into a valid ParameterValue.","triggerScenarios":"pd.createValue(this, Util.fixNull(e.getValue())) returns null — the value string does not match the parameter type's expected format or constraints. For example, a BooleanParameterDefinition receiving an unparseable string, or a ChoiceParameterDefinition receiving a value not in the choices list.","commonSituations":"Passing 'yes' or '1' to a boolean parameter that expects 'true'/'false' (depending on the implementation); passing a value not in a Choice parameter's options; passing an invalid file path to a File parameter; passing a malformed string to a Run parameter; passing null or empty for a parameter that requires a value.","solutions":["Check the parameter type in the job configuration and provide a value in the expected format.","For Choice parameters, verify the value matches one of the defined choices exactly (case-sensitive).","For Boolean parameters, use 'true' or 'false'.","For File parameters, ensure the file exists and the path is correct."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate parameter value type before calling createValue\nParameterDefinition pd = pdp.getParameterDefinition(name);\nif (pd != null) {\n    ParameterValue val = pd.createValue(Util.fixNull(value));\n    if (val == null) {\n        throw new AbortException(\"Value '\" + value + \"' is not valid for parameter '\" + name + \"' (type: \" + pd.getType() + \")\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    // build command run()\n} catch (CmdLineException e) {\n    if (e.getMessage().contains(\"Cannot resolve the value\")) {\n        stderr.println(e.getMessage());\n        stderr.println(\"Check the parameter type and expected format in the job configuration.\");\n        return 1;\n    }\n    throw e;\n}","preventionTips":["Match the value format to the parameter type (boolean: true/false, choice: exact option, etc.).","Use the Jenkins API to discover parameter types and valid values before constructing CLI commands.","For choice parameters, list valid options from the API."],"tags":["cli","build","parameters","validation","type-conversion"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}