{"record":{"id":"412e8b8643aa1706","repo":"flowable/flowable-engine","slug":"invalid-body-was-supplied","errorCode":null,"errorMessage":"Invalid body was supplied","messagePattern":"Invalid body was supplied","errorType":"validation","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceVariableResource.java","lineNumber":112,"sourceCode":"        RestVariable result = null;\n        if (request instanceof MultipartHttpServletRequest) {\n            result = setBinaryVariable((MultipartHttpServletRequest) request, caseInstance.getId(), CmmnRestResponseFactory.VARIABLE_CASE, false,\n                    false, RestVariable.RestVariableScope.GLOBAL, createVariableInterceptor(caseInstance));\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            RestVariable restVariable = null;\n            try {\n                restVariable = objectMapper.readValue(request.getInputStream(), RestVariable.class);\n            } catch (Exception e) {\n                throw new FlowableIllegalArgumentException(\"request body could not be transformed to a 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, caseInstance.getId(), false, false, RestVariable.RestVariableScope.GLOBAL, CmmnRestResponseFactory.VARIABLE_CASE, createVariableInterceptor(caseInstance));\n        }\n        return result;\n    }\n    \n    @ApiOperation(value = \"Update a single variable on a case instance asynchronously\", tags = { \"Case Instance Variables\" }, nickname = \"updateCaseInstanceVariableAsync\",\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                    + \"Note that scope is ignored, only global variables can be set in a case instance.\\n\"\n                    + \"NB: Swagger V2 specification doesn't 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.cmmn.service.api.engine.variable.RestVariable\", value = \"Create a variable on a case instance\", paramType = \"body\", example = \"{\\n\" +\n                    \"    \\\"name\\\":\\\"intProcVar\\\"\\n\" +\n                    \"    \\\"type\\\":\\\"integer\\\"\\n\" +","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceVariableResource.java#L94-L130","documentation":"Thrown by updateVariable when the body deserializes successfully but yields a null RestVariable — in practice this means an empty or effectively empty request body was supplied. Flowable raises FlowableException 'Invalid body was supplied' because a variable update requires an actual variable representation.","triggerScenarios":"PUT /cmmn-runtime/case-instances/{id}/variables/{name} with a completely empty body (or a body Jackson maps to null, e.g. the literal 'null') on a non-multipart request.","commonSituations":"Calling the endpoint with no body at all (curl without -d); clients serializing undefined/null variables; middleware stripping the body; tests sending empty payloads expecting defaults.","solutions":["Provide a non-empty RestVariable JSON body with at least name, value and type.","Check the client so it doesn't serialize undefined/null as the whole body.","Verify HTTP client configuration that the body is actually attached and Content-Length > 0.","If you intended to delete the variable, use the DELETE variable endpoint instead of PUT."],"exampleFix":"// before\ncurl -X PUT .../variables/count -H 'Content-Type: application/json'\n// after\ncurl -X PUT .../variables/count -H 'Content-Type: application/json' -d '{\"name\":\"count\",\"value\":0,\"type\":\"integer\"}'","handlingStrategy":"validation","validationCode":"if (!body || Object.keys(body).length === 0) {\n  throw new Error('updateVariable requires a non-empty RestVariable body');\n}","typeGuard":"function hasRestVariableBody(v) {\n  return v !== null && v !== undefined && typeof v === 'object';\n}","tryCatchPattern":"try {\n  await updateCaseVariable(caseId, name, body);\n} catch (e) {\n  if (e.status === 400 || e.status === 500) { /* check that a body was actually attached */ }\n  else throw e;\n}","preventionTips":["Never call PUT variable endpoints without a body.","Guard against null/undefined values being serialized as the whole payload.","Use DELETE for variable removal instead of sending an empty PUT."],"tags":["rest-api","variables","empty-body","validation","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-14T05:17:10.506Z"}