{"record":{"id":"8f115242005fccbb","repo":"flowable/flowable-engine","slug":"could-not-resolve-key-for-eventdefinitionkey-i","errorCode":null,"errorMessage":"Could not resolve key for: ${eventDefinitionKey} in ${executionEntity}","messagePattern":"Could not resolve key for: (.+?) in (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventRegistryEventActivityBehavior.java","lineNumber":113,"sourceCode":"                    CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription);\n                }\n            }\n        }\n\n        super.trigger(executionEntity, triggerName, triggerData);\n    }\n\n    protected String getEventDefinitionKey(ExecutionEntity executionEntity, ProcessEngineConfigurationImpl processEngineConfiguration) {\n        Object key = null;\n\n        if (StringUtils.isNotEmpty(eventDefinitionKey)) {\n            Expression expression = processEngineConfiguration.getExpressionManager()\n                    .createExpression(eventDefinitionKey);\n            key = expression.getValue(executionEntity);\n        }\n\n        if (key == null) {\n            throw new FlowableException(\"Could not resolve key for: \" + eventDefinitionKey + \" in \" + executionEntity);\n        }\n\n        return key.toString();\n    }\n}","sourceCodeStart":95,"sourceCodeEnd":118,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryEventRegistryEventActivityBehavior.java#L95-L118","documentation":"Flowable throws this in BoundaryEventRegistryEventActivityBehavior.getEventDefinitionKey when the event registry event definition key cannot be resolved to an actual value. The key can be a fixed string or an expression; when it is null after static resolution and expression evaluation against the execution, the behavior cannot subscribe to the registry event and aborts. This means the configured key is empty/blank or the expression evaluated to null.","triggerScenarios":"A boundary event with a registry (event-registry) event definition whose key attribute is empty, or whose key expression (e.g. ${eventKey}) resolves to null because the referenced process variable is unset at the time the execution reaches the boundary event.","commonSituations":"Forgetting to set the process variable used in the key expression before reaching the boundary event; a typo in the variable name inside the expression; deploying a model where the event-registry key was never configured; case-sensitivity issues in variable names.","solutions":["Ensure the variable used in the key expression is set (correlation-initiating or via an execution listener) before the flow reaches the boundary event.","Check the event key configured on the boundary event definition in the BPMN XML / modeler is non-empty.","Test the expression independently (e.g. log ${eventKey}) to see what it evaluates to.","If the key should be static, replace the expression with a literal event key string registered in the event registry."],"exampleFix":"// before (expression may be null)\n<flowable:eventDefinitionKey>${missingEventKey}</flowable:eventDefinitionKey>\n\n// after (set variable before the boundary event, or use a static key)\n<flowable:eventDefinitionKey>order-cancelled-event</flowable:eventDefinitionKey>","handlingStrategy":"validation","validationCode":"// before reaching the boundary event, guarantee the key variable exists\nexecution.setVariable(\"orderCancelledEventKey\", \"order-cancelled-event\");\n// or validate before start:\nif (variables.get(\"orderCancelledEventKey\") == null) {\n    throw new IllegalArgumentException(\"orderCancelledEventKey must be set for event registry boundary event\");\n}","typeGuard":"boolean hasEventKey(DelegateExecution execution, String varName) {\n    Object v = execution.getVariable(varName);\n    return v instanceof String && !((String) v).isBlank();\n}","tryCatchPattern":"try {\n    runtimeService.startProcessInstanceByKey(\"myProcess\", variables);\n} catch (FlowableException e) {\n    if (e.getMessage().startsWith(\"Could not resolve key for\")) {\n        // set the missing event-key variable or correct the expression\n    }\n}","preventionTips":["Initialize all event-registry key variables at process start via a start listener or start form.","Prefer static literal keys over expressions unless dynamic correlation is truly required.","Add a unit test asserting the key expression resolves to a non-null string before deployment."],"tags":["flowable","event-registry","expression","boundary-event","null-value"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}