{"record":{"id":"8add9f6a1375bf69","repo":"flowable/flowable-engine","slug":"invalid-body-was-supplied-8add9f","errorCode":null,"errorMessage":"Invalid body was supplied","messagePattern":"Invalid body was supplied","errorType":"exception","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ExecutionVariableResource.java","lineNumber":121,"sourceCode":"        if (request instanceof MultipartHttpServletRequest) {\n            result = setBinaryVariable((MultipartHttpServletRequest) request, execution, false, false);\n\n            if (!result.getName().equals(variableName)) {\n                throw new FlowableIllegalArgumentException(\"Variable name in the body should be equal to the name used in the requested URL.\");\n            }\n\n        } else {\n\n            RestVariable restVariable = null;\n\n            try {\n                restVariable = objectMapper.readValue(request.getInputStream(), RestVariable.class);\n            } catch (Exception e) {\n                throw new FlowableIllegalArgumentException(\"Error converting request body to RestVariable instance\", e);\n            }\n\n            if (restVariable == null) {\n                throw new FlowableException(\"Invalid body was supplied\");\n            }\n            if (!restVariable.getName().equals(variableName)) {\n                throw new FlowableIllegalArgumentException(\"Variable name in the body should be equal to the name used in the requested URL.\");\n            }\n\n            result = setSimpleVariable(restVariable, execution, false, false);\n        }\n        return result;\n    }\n    \n    @ApiOperation(value = \"Update a variable on an execution asynchronously\", tags = { \"Executions\" }, nickname = \"updateExecutionVariableAsync\",\n            notes = \"This endpoint can be used in 2 ways: By passing a JSON Body (RestVariable) or by passing a multipart/form-data Object.\\n\"\n                    + \"NB: Swagger V2 specification does not support this use case that is why this endpoint might be buggy/incomplete if used with other tools.\")\n    @ApiImplicitParams({\n            @ApiImplicitParam(name = \"body\", type = \"org.flowable.rest.service.api.engine.variable.RestVariable\", value = \"Update a variable on an execution\", paramType = \"body\", example = \"{\\n\" +\n                    \"    \\\"name\\\":\\\"intProcVar\\\"\\n\" +\n                    \"    \\\"type\\\":\\\"integer\\\"\\n\" +\n                    \"    \\\"value\\\":123,\\n\" +","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ExecutionVariableResource.java#L103-L139","documentation":"This FlowableException is thrown by updateVariable on the execution variable REST resource when the request body could not be parsed into a RestVariable (the deserialization produced null). The endpoint requires a JSON body representing the variable to set; an absent, empty, or unparseable body leaves restVariable null and the update is rejected. It signals a malformed request rather than a server-side problem.","triggerScenarios":"PUT/POST to /runtime/process-instances/{executionId}/variables/{variableName} with an empty body, a body that is not valid JSON, or a body that Jackson deserializes to null (e.g. literal 'null').","commonSituations":"Clients forgetting to send a request body, wrong Content-Type (e.g. text/plain instead of application/json so Jackson never parses it), shell/curl quoting mistakes producing an empty -d argument, or proxies stripping the body.","solutions":["Send a valid JSON RestVariable body, e.g. {\"name\":\"myVar\",\"type\":\"string\",\"value\":\"foo\"}","Set the Content-Type header to application/json","Verify the request actually contains a body (curl -d @file.json) rather than an empty string","Confirm the JSON top-level is an object, not the literal null","If the body is intentionally malformed, expect FlowableIllegalArgumentException 400 instead and fix the payload"],"exampleFix":"// before\ncurl -X PUT -H 'Content-Type: application/json' \\\n  '.../runtime/process-instances/5/variables/myVar' -d ''\n// after\ncurl -X PUT -H 'Content-Type: application/json' \\\n  '.../runtime/process-instances/5/variables/myVar' \\\n  -d '{\"name\":\"myVar\",\"type\":\"string\",\"value\":\"foo\"}'","handlingStrategy":"validation","validationCode":"const body = { name: variableName, type, value };\nconst json = JSON.stringify(body);\nif (!json || json === '\"null\"') throw new Error('RestVariable body required');\nawait fetch(url, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: json });","typeGuard":"function isValidRestVariable(b) {\n  return !!b && typeof b === 'object' && !Array.isArray(b) && typeof b.name === 'string' && b.name.length > 0;\n}","tryCatchPattern":"try { await updateVariable(...); } catch (e) { if (e.status === 400 && /Invalid body/.test(e.body?.message || '')) { /* fix payload and retry once */ } else { throw e; } }","preventionTips":["Always send a JSON object body with name/type/value","Set Content-Type: application/json explicitly","Check curl -d arguments are non-empty","Log outgoing bodies in integration tests"],"tags":["rest","validation","request-body","flowable"],"backgroundTag":"empty-required-field","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}