{"record":{"id":"6db30247b423663d","repo":"flowable/flowable-engine","slug":"invalid-body-was-supplied-6db302","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/PlanItemInstanceVariableResource.java","lineNumber":102,"sourceCode":"        RestVariable result = null;\n        if (request instanceof MultipartHttpServletRequest) {\n            result = setBinaryVariable((MultipartHttpServletRequest) request, planItem.getId(), CmmnRestResponseFactory.VARIABLE_PLAN_ITEM, false,\n                    false, RestVariable.RestVariableScope.LOCAL, createVariableInterceptor(planItem));\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(\"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, planItem.getId(), false, false, RestVariable.RestVariableScope.LOCAL, CmmnRestResponseFactory.VARIABLE_PLAN_ITEM, createVariableInterceptor(planItem));\n        }\n        return result;\n    }\n    \n    @ApiOperation(value = \"Update a variable on a plan item asynchronously\", tags = { \"Plan Item Instances\" }, nickname = \"updatePlanItemVariableAsync\",\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 a plan item instance\", paramType = \"body\", example =\n                    \"{\\n\" +\n                            \"    \\\"name\\\":\\\"intProcVar\\\"\\n\" +\n                            \"    \\\"type\\\":\\\"integer\\\"\\n\" +","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/PlanItemInstanceVariableResource.java#L84-L120","documentation":"Thrown when updateVariable successfully reads the request stream but the parsed RestVariable is null — i.e. an empty or null body was supplied. Unlike the parse failure case, the body deserialized fine (or was empty), so Flowable raises a plain FlowableException ('Invalid body was supplied') to reject the request before any variable write occurs.","triggerScenarios":"PUT /cmmn-runtime/plan-item-instances/{id}/variables/{name} with an empty request body, or a body that deserializes to a null RestVariable.","commonSituations":"Clients sending PUT with no payload; Content-Length 0 behind a gateway; a templating bug that renders an empty JSON document; curl invocations missing -d/--data.","solutions":["Always send a valid RestVariable JSON body, e.g. {\"name\":\"amount\",\"type\":\"integer\",\"value\":42}.","Check the HTTP client is not silently dropping the body on PUT (some clients require explicit body/Content-Length).","Log/inspect the outgoing request payload to confirm it is non-empty before sending."],"exampleFix":"// before\nclient.put(url, null);\n// after\nclient.putJson(url, \"{\\\"name\\\":\\\"amount\\\",\\\"value\\\":42}\");","handlingStrategy":"validation","validationCode":"if (!body || Object.keys(body).length === 0) { throw new Error('PUT body required for variable update'); }","typeGuard":"function hasBody(b) { return b != null && typeof b === 'object' && Object.keys(b).length > 0; }","tryCatchPattern":"try { api.updateVariable(id, name, body); }\ncatch (FlowableException e) { if ('Invalid body was supplied'.equals(e.getMessage())) { rebuildBodyAndRetryOnce(); } else throw e; }","preventionTips":["Never issue PUT without a serialized payload; assert body presence in your client wrapper.","Some HTTP clients omit bodies on PUT unless explicitly configured — verify client settings.","Log outgoing payload size to detect empty-body regressions."],"tags":["rest-api","empty-body","request-validation","cmmn"],"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-14T16:17:12.679Z"}