{"record":{"id":"73be76e6207c84cf","repo":"flowable/flowable-engine","slug":"cannot-start-case-instance-no-case-instance-build-73be76","errorCode":null,"errorMessage":"Cannot start case instance: no case instance builder provided","messagePattern":"Cannot start case instance: no case instance builder provided","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/StartCaseInstanceCmd.java","lineNumber":40,"sourceCode":"import org.flowable.common.engine.impl.interceptor.CommandContext;\n\n/**\n * @author Joram Barrez\n */\npublic class StartCaseInstanceCmd implements Command<CaseInstance>, Serializable {\n\n    protected CaseInstanceBuilder caseInstanceBuilder;\n    \n    public StartCaseInstanceCmd(CaseInstanceBuilder caseInstanceBuilder) {\n        this.caseInstanceBuilder = caseInstanceBuilder;\n    }\n\n    @Override\n    public CaseInstance execute(CommandContext commandContext) {\n        if (caseInstanceBuilder != null) {\n            return CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCaseInstanceHelper().startCaseInstance(caseInstanceBuilder);\n        } else {\n            throw new FlowableIllegalArgumentException(\"Cannot start case instance: no case instance builder provided\");\n        }\n    }\n   \n}\n","sourceCodeStart":22,"sourceCodeEnd":45,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/StartCaseInstanceCmd.java#L22-L45","documentation":"StartCaseInstanceCmd starts a case instance synchronously using the supplied CaseInstanceBuilder. A null builder provides no case definition information, so execute throws FlowableIllegalArgumentException before delegating to CaseInstanceHelper.startCaseInstance.","triggerScenarios":"Calling the command with null (direct command execution, misconfigured factory) instead of a builder obtained from cmmnRuntimeService.createCaseInstanceBuilder().","commonSituations":"Custom service wrappers that forget to build the builder; test code invoking the command directly; refactoring that dropped builder initialization.","solutions":["Use cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey(...).start() rather than the raw command.","When invoking StartCaseInstanceCmd directly, pass a non-null CaseInstanceBuilder instance.","Add an Objects.requireNonNull(builder) check in the calling wrapper for a clearer failure."],"exampleFix":"// before\ncmmnEngineConfiguration.getCommandExecutor().execute(new StartCaseInstanceCmd(builder)); // builder == null\n// after\nCaseInstanceBuilder builder = cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey(\"myCase\");\nCaseInstance ci = builder.start();","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(builder, \"builder is required\");\nif (builder instanceof CaseInstanceBuilderImpl) { /* proceed */ }","typeGuard":null,"tryCatchPattern":"try {\n    CaseInstance ci = builder.start();\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"no case instance builder provided\")) {\n        // caller bug: builder was null\n    }\n}","preventionTips":["Use builder.start() from the runtime service instead of invoking commands directly","In tests, construct builders through the engine configuration","Fail fast in factory methods that may return null builders"],"tags":["cmmn","null-argument","case-start","builder"],"backgroundTag":"null-argument","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"}