{"record":{"id":"6f8a77d2950173f4","repo":"flowable/flowable-engine","slug":"could-not-find-engine-configuration-with-variable","errorCode":null,"errorMessage":"Could not find engine configuration with variable service configuration","messagePattern":"Could not find engine configuration with variable service configuration","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/types/TraceableObject.java","lineNumber":73,"sourceCode":"                        variableInstanceEntity, variableServiceConfiguration.getClock().getCurrentTime());\n            }\n        }\n    }\n    \n    protected VariableServiceConfiguration getVariableServiceConfiguration() {\n        String engineType = getEngineType(variableInstanceEntity.getScopeType());\n        Map<String, AbstractEngineConfiguration> engineConfigurationMap = Context.getCommandContext().getEngineConfigurations();\n        AbstractEngineConfiguration engineConfiguration = engineConfigurationMap.get(engineType);\n        if (engineConfiguration == null) {\n            for (AbstractEngineConfiguration possibleEngineConfiguration : engineConfigurationMap.values()) {\n                if (possibleEngineConfiguration instanceof HasVariableServiceConfiguration) {\n                    engineConfiguration = possibleEngineConfiguration;\n                }\n            }\n        }\n        \n        if (engineConfiguration == null) {\n            throw new FlowableException(\"Could not find engine configuration with variable service configuration\");\n        }\n        \n        if (!(engineConfiguration instanceof HasVariableServiceConfiguration)) {\n            throw new FlowableException(\"Variable entity engine scope has no variable service configuration \" + engineType);\n        }\n        \n        return (VariableServiceConfiguration) engineConfiguration.getServiceConfigurations().get(EngineConfigurationConstants.KEY_VARIABLE_SERVICE_CONFIG);\n    }\n    \n    protected String getEngineType(String scopeType) {\n        if (StringUtils.isNotEmpty(scopeType)) {\n            return scopeType;\n        } else {\n            return ScopeTypes.BPMN;\n        }\n    }\n}\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/types/TraceableObject.java#L55-L91","documentation":"TraceableObject (used by traceable serializable variable types to reach the engine) scans registered engine configurations to find one exposing a VariableServiceConfiguration. When no known engine configuration carries the variable service configuration, this FlowableException is thrown. It indicates the object is being resolved outside a properly initialized engine context.","triggerScenarios":"Calling getVariableServiceConfiguration when EngineConfigurations.getEngineConfiguration(...) returns null for the engine type — i.e., the engine configuration was not registered, the scope type maps to an unknown engine, or the code runs outside any started process engine.","commonSituations":"Using traceable variable types in a standalone/unit-test setup where the full engine configuration set was never registered; multiple engine configurations where the variable-service key was removed; deserializing traceable objects in a different JVM/app that lacks the engine configuration.","solutions":["Ensure the process engine (and its variable service configuration) is fully built and registered before objects using TraceableObject are serialized/deserialized","Check that the scope type maps to a registered engine configuration (getEngineType lookup) and that EngineConfigurationConstants.KEY_VARIABLE_SERVICE_CONFIG is present in the service configurations","In tests, build the full engine via ProcessEngineConfiguration rather than partial configuration objects","If deserializing in another application, register an engine configuration implementing HasVariableServiceConfiguration first"],"exampleFix":"// before\nEngineConfiguration cfg = EngineConfigurations.getEngineConfiguration(engineType); // null -> throw\n// after\nif (cfg == null) {\n    cfg = ProcessEngines.getDefaultProcessEngine().getProcessEngineConfiguration();\n}","handlingStrategy":"validation","validationCode":"EngineConfiguration cfg = ProcessEngineConfigurationImpl\n    .getEngineConfigurations() == null ? null\n    : org.flowable.common.engine.impl.EngineConfigurations.getEngineConfiguration(\n          ProcessEngines.getDefaultProcessEngine().getProcessEngineConfiguration().getEngineType());\nif (cfg == null || !(cfg instanceof HasVariableServiceConfiguration)) {\n    throw new IllegalStateException(\"No engine configuration with variable service support registered\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start the full process engine before touching traceable variable objects","In tests, use the standard ProcessEngineConfiguration builder instead of partial configs","Never serialize traceable variable types into a different application/JVM without registering an engine configuration there"],"tags":["engine-configuration","variables","initialization"],"backgroundTag":"missing-configuration","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"}