{"record":{"id":"fd2c07d6623e2781","repo":"flowable/flowable-engine","slug":"exception-while-executing-command","errorCode":null,"errorMessage":"exception while executing command ","messagePattern":"exception while executing command ","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/interceptor/CommandContext.java","lineNumber":142,"sourceCode":"            LOGGER.debug(\"Optimistic locking exception : {}\", exception.getMessage(), exception);\n            \n        } else if (exception instanceof FlowableException && ((FlowableException) exception).isReduceLogLevel()) {\n            // reduce log level, because this may have been caused because of job deletion due to cancelActiviti=\"true\"\n            LOGGER.info(\"Error while closing command context\", exception);\n            \n        } else {\n            LOGGER.error(\"Error while closing command context\", exception);\n            \n        }\n    }\n\n    protected void rethrowExceptionIfNeeded() throws Error {\n        if (exception instanceof Error) {\n            throw (Error) exception;\n        } else if (exception instanceof RuntimeException) {\n            throw (RuntimeException) exception;\n        } else {\n            throw new FlowableException(\"exception while executing command \" + command, exception);\n        }\n    }\n\n    public void addCloseListener(CommandContextCloseListener commandContextCloseListener) {\n        if (closeListeners == null) {\n            closeListeners = new ArrayList<>();\n        }\n        \n        if (!commandContextCloseListener.multipleAllowed()) {\n            for (CommandContextCloseListener closeListenerItem : closeListeners) {\n    \t\t\tif (closeListenerItem.getClass().equals(commandContextCloseListener.getClass())) {\n    \t\t\t\treturn;\n    \t\t\t}\n    \t\t}\n        }\n        \n        closeListeners.add(commandContextCloseListener);\n        ","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/interceptor/CommandContext.java#L124-L160","documentation":"Rethrown by CommandContext.rethrowExceptionIfNeeded during close(): the command being executed failed with an exception that is neither an optimistic-locking nor a reduce-log FlowableException; the original error is wrapped/rethrown with this prefix so it propagates out of the command context with context about which command failed.","triggerScenarios":"Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/interceptor/CommandContext.java:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the cause and the failing command name to locate the real error","Fix the underlying failure (usually a business or mapping error), not this wrapper"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}