{"record":{"id":"4d8b462f1349b52c","repo":"flowable/flowable-engine","slug":"child-task-variables-can-only-be-set-when-starting","errorCode":null,"errorMessage":"Child task variables can only be set when starting a plan item instance","messagePattern":"Child task variables can only be set when starting a plan item instance","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceTransitionBuilderImpl.java","lineNumber":236,"sourceCode":"    }\n\n    @Override\n    public void completeStage() {\n        validateChildTaskVariablesNotSet();\n        commandExecutor.execute(new CompleteStagePlanItemInstanceCmd(planItemInstanceId, variables, formVariables, formOutcome, \n                formInfo, localVariables, transientVariables, false));\n    }\n\n    @Override\n    public void forceCompleteStage() {\n        validateChildTaskVariablesNotSet();\n        commandExecutor.execute(new CompleteStagePlanItemInstanceCmd(planItemInstanceId, variables, formVariables, formOutcome, \n                formInfo, localVariables, transientVariables, true));\n    }\n\n    protected void validateChildTaskVariablesNotSet() {\n        if (childTaskVariables != null) {\n            throw new FlowableIllegalArgumentException(\"Child task variables can only be set when starting a plan item instance\");\n        }\n\n        if (childTaskFormInfo != null) {\n            throw new FlowableIllegalArgumentException(\"Child form variables can only be set when starting a plan item instance\");\n        }\n    }\n}\n","sourceCodeStart":218,"sourceCodeEnd":244,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceTransitionBuilderImpl.java#L218-L244","documentation":"PlanItemInstanceTransitionBuilderImpl.validateChildTaskVariablesNotSet() throws FlowableIllegalArgumentException when childTaskVariables were set but the transition is not a start operation. Child task variables are only meaningful when starting a plan item instance that will create a child task; any other transition (trigger, enable, disable, suspend, resume, terminate) rejects them.","triggerScenarios":"Calling a transition builder that did planItemInstanceBuilder.childTaskVariables(...) and then invoking trigger()/enable()/disable()/suspend()/resume()/terminate() instead of start().","commonSituations":"Generic transition dispatch code that sets child task variables for every operation; copying a start() example and swapping the terminal operation for trigger().","solutions":["Use start() when child task variables are set — that is the only transition that accepts them.","Remove the childTaskVariables(...) call for non-start transitions and pass plain variables(variables) instead.","Branch on the intended operation before populating the builder."],"exampleFix":"// before\nbuilder.childTaskVariables(childVars).trigger(); // invalid transition\n// after\nbuilder.childTaskVariables(childVars).start();\n// or, for trigger:\nbuilder.variables(vars).trigger();","handlingStrategy":"validation","validationCode":"if (childTaskVariables != null && operation != Operation.START) { childTaskVariables = null; }","typeGuard":null,"tryCatchPattern":"try { builder.trigger(); } catch (FlowableIllegalArgumentException e) { throw new IllegalStateException(\"childTaskVariables require start()\", e); }","preventionTips":["Only set childTaskVariables on builders that will terminate with start().","Centralize transition building so operation and child variables are validated together."],"tags":["flowable","cmmn","transition","invalid-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}