{"record":{"id":"13be870904035e27","repo":"flowable/flowable-engine","slug":"include-in-stage-overview-expression-does-not-reso","errorCode":null,"errorMessage":"Include in stage overview expression does not resolve to a boolean value ${includeInStageOverview}: ${stageValueObject} for ${variableContainer}","messagePattern":"Include in stage overview expression does not resolve to a boolean value (.+?): (.+?) for (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStageOverviewCmd.java","lineNumber":151,"sourceCode":"\n                // If not ended or current, it's implicitly a future one\n                if (planItemInstance.isPresent()) {\n                    stageResponse.setEndTime(planItemInstance.get().getEndedTime());\n                    stageResponse.setEnded(stageResponse.getEndTime() != null);\n                    stageResponse.setCurrent(PlanItemInstanceState.ACTIVE.equals(planItemInstance.get().getState()));\n                }\n\n                stageResponses.add(stageResponse);\n            }\n        }\n\n        return stageResponses;\n    }\n    \n    protected boolean evaluateIncludeInStageOverviewExpression(Expression stageExpression, String includeInStageOverview, VariableContainer variableContainer) {\n        Object stageValueObject = stageExpression.getValue(variableContainer);\n        if (!(stageValueObject instanceof Boolean)) {\n            throw new FlowableException(\"Include in stage overview expression does not resolve to a boolean value \" + \n                            includeInStageOverview + \": \" + stageValueObject + \" for \" + variableContainer);\n        }\n        \n        return (Boolean) stageValueObject;\n    }\n    \n    protected Date getPlanItemInstanceEndTime(List<PlanItemInstance> planItemInstances, PlanItemDefinition planItemDefinition) {\n        return getPlanItemInstance(planItemInstances, planItemDefinition)\n            .map(PlanItemInstance::getEndedTime)\n            .orElse(null);\n    }\n\n    protected Optional<PlanItemInstance> getPlanItemInstance(List<PlanItemInstance> planItemInstances, PlanItemDefinition planItemDefinition) {\n        PlanItemInstance planItemInstance = null;\n        for (PlanItemInstance p : planItemInstances) {\n            if (p.getPlanItemDefinitionId().equals(planItemDefinition.getId())) {\n                \n                if (p.getEndedTime() == null) {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStageOverviewCmd.java#L133-L169","documentation":"GetStageOverviewCmd evaluates the stage's 'include in stage overview' expression and requires it to resolve to a java.lang.Boolean. Flowable throws FlowableException when the expression yields any other type (String, Integer, null), because the result is cast directly to Boolean.","triggerScenarios":"A stage plan item's includeInStageOverviewExpression (stage overview expression) evaluates against case variables and returns a non-Boolean, e.g. the expression references a String variable like ${includeFlag} where includeFlag='true'.","commonSituations":"Setting the expression to a variable holding the string 'true' instead of a boolean; expression resolving to null because the variable is missing; using an expression that returns a number or object.","solutions":["Change the expression so it yields a boolean, e.g. ${includeFlag == 'true'} or ${booleanVar}","Store the underlying case variable as a Boolean (caseService.setVariable(id, \"includeFlag\", true)) rather than a String","Add a default: ${includeFlag != null && includeFlag == true} to guard against null","Inspect the referenced variable in the running case instance to see its actual type"],"exampleFix":"// before (expression resolves to String)\n<planItemDefinition ... flowable:includeInStageOverviewExpression=\"${includeFlag}\"/>\n// after\n<planItemDefinition ... flowable:includeInStageOverviewExpression=\"${includeFlag == 'true'}\"/>","handlingStrategy":"validation","validationCode":"Object v = caseService.getVariable(caseInstanceId, \"includeFlag\");\nif (!(v instanceof Boolean)) {\n    throw new IllegalStateException(\"includeFlag must be a Boolean, got: \" + (v == null ? \"null\" : v.getClass().getName()));\n}","typeGuard":"boolean isBooleanExpressionValue(Object o) { return o instanceof Boolean; }","tryCatchPattern":"try {\n    List<StageResponse> stages = cmmnRuntimeService.getStageOverview(caseInstanceId, null);\n} catch (FlowableException e) {\n    if (e.getMessage().startsWith(\"Include in stage overview expression\")) {\n        // fix model expression / variable type\n    }\n}","preventionTips":["Keep includeInStageOverview expressions boolean-typed (${flag}, ${a == b})","Store flags as Boolean case variables, not Strings","Add null-safe defaults in expressions: ${flag != null && flag == true}"],"tags":["cmmn","expression","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}