{"record":{"id":"b2007c42401cbde3","repo":"conductor-oss/conductor","slug":"priority-must-be-between-0-and-99-inclusive","errorCode":null,"errorMessage":"priority MUST be between 0 and 99 (inclusive)","messagePattern":"priority MUST be between 0 and 99 \\(inclusive\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/com/netflix/conductor/common/run/Workflow.java","lineNumber":421,"sourceCode":"     * @return the external storage path of the workflow output payload\n     */\n    public String getExternalOutputPayloadStoragePath() {\n        return externalOutputPayloadStoragePath;\n    }\n\n    /**\n     * @return the priority to define on tasks\n     */\n    public int getPriority() {\n        return priority;\n    }\n\n    /**\n     * @param priority priority of tasks (between 0 and 99)\n     */\n    public void setPriority(int priority) {\n        if (priority < 0 || priority > 99) {\n            throw new IllegalArgumentException(\"priority MUST be between 0 and 99 (inclusive)\");\n        }\n        this.priority = priority;\n    }\n\n    /**\n     * Convenience method for accessing the workflow definition name.\n     *\n     * @return the workflow definition name.\n     */\n    public String getWorkflowName() {\n        if (workflowDefinition == null) {\n            throw new NullPointerException(\"Workflow definition is null\");\n        }\n        return workflowDefinition.getName();\n    }\n\n    /**\n     * Convenience method for accessing the workflow definition version.","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/common/src/main/java/com/netflix/conductor/common/run/Workflow.java#L403-L439","documentation":"Workflow.setPriority enforces that task scheduling priority is an integer in the closed range [0, 99]. Values below 0 or above 99 are rejected immediately. Priority influences the relative scheduling precedence of a workflow's tasks.","triggerScenarios":"Calling workflow.setPriority(n) (or submitting a workflow payload with a 'priority' field) where n < 0 or n > 99.","commonSituations":"UI or config passing 100 or 999 as a 'max priority' sentinel; negative values from a default/unset integer (-1); arithmetic that overflows the intended range.","solutions":["Clamp the priority into [0, 99] before setting it.","Use 0 (default/lowest) when priority is unspecified instead of a sentinel like -1.","Validate the value at the API/config boundary before it reaches Workflow."],"exampleFix":"// before: out-of-range value throws\nworkflow.setPriority(requestedPriority);\n\n// after: clamp into valid range\nint p = Math.max(0, Math.min(99, requestedPriority));\nworkflow.setPriority(p);","handlingStrategy":"validation","validationCode":"// Validate priority range before setting\nstatic boolean isValidPriority(int p) {\n    return p >= 0 && p <= 99;\n}\nif (!isValidPriority(requestedPriority)) {\n    throw new IllegalArgumentException(\"priority must be 0..99, got \" + requestedPriority);\n}","typeGuard":null,"tryCatchPattern":"// Clamp or reject out-of-range priority at the boundary\ntry {\n    workflow.setPriority(requestedPriority);\n} catch (IllegalArgumentException e) {\n    workflow.setPriority(Math.max(0, Math.min(99, requestedPriority)));\n}","preventionTips":["Clamp priority to [0, 99] at the API/config boundary.","Use 0 for 'unspecified' instead of sentinel values like -1.","Validate priority in UI/config forms before submission."],"tags":["workflow","validation","priority","input"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}