{"record":{"id":"9676fe5348872cd2","repo":"jenkinsci/jenkins","slug":"is-not-parameterized-but-the-p-option-was-spec","errorCode":null,"errorMessage":"{} is not parameterized but the -p option was specified.","messagePattern":"(.+?) is not parameterized but the -p option was specified\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/cli/BuildCommand.java","lineNumber":108,"sourceCode":"    public Map<String, String> parameters = new HashMap<>();\n\n    @Option(name = \"-v\", usage = \"Prints out the console output of the build. Use with -s\")\n    public boolean consoleOutput = false;\n\n    @Option(name = \"-r\") @Deprecated\n    public int retryCnt = 10;\n\n    protected static final String BUILD_SCHEDULING_REFUSED = \"Build scheduling Refused by an extension, hence not in Queue.\";\n\n    @Override\n    protected int run() throws Exception {\n        job.checkPermission(Item.BUILD);\n\n        ParametersAction a = null;\n        if (!parameters.isEmpty()) {\n            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);","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/cli/BuildCommand.java#L90-L126","documentation":"Thrown by BuildCommand.run() when the user supplies build parameters via -p but the target job has no ParametersDefinitionProperty (i.e., the job is not parameterized). This is an IllegalStateException indicating a mismatch between user input and job configuration.","triggerScenarios":"The parameters map (populated from -p CLI arguments) is non-empty, but job.getProperty(ParametersDefinitionProperty.class) returns null.","commonSituations":"Calling 'jenkins-cli build <job> -p KEY=VALUE' on a freestyle job that has no 'This project is parameterized' checkbox enabled; calling on a Pipeline job without parameters defined; job parameters were removed after a script was written that still passes -p.","solutions":["Enable parameterization on the job: in job configuration, check 'This project is parameterized' and add the parameter definitions.","Remove the -p arguments from the CLI command if the job is intentionally non-parameterized.","If the job was recently changed, update the calling script or CI integration to match the current job configuration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check if job is parameterized before passing -p\nParametersDefinitionProperty pdp = job.getProperty(ParametersDefinitionProperty.class);\nif (pdp == null && !parameters.isEmpty()) {\n    throw new AbortException(job.getFullDisplayName() + \" is not parameterized. Remove -p or add parameters to the job.\");\n}","typeGuard":"public static boolean isParameterized(Job<?, ?> job) {\n    return job.getProperty(ParametersDefinitionProperty.class) != null;\n}","tryCatchPattern":"try {\n    // build command run()\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"is not parameterized\")) {\n        stderr.println(e.getMessage());\n        stderr.println(\"Enable 'This project is parameterized' in job configuration.\");\n        return 1;\n    }\n    throw e;\n}","preventionTips":["Verify job parameterization before scripting -p arguments.","Keep job configurations and calling scripts in sync.","Use the Jenkins API to introspect parameter definitions programmatically."],"tags":["cli","build","parameters","configuration"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}