{"record":{"id":"a19c5645c65dc728","repo":"flowable/flowable-engine","slug":"variable-name-in-the-body-should-be-equal-to-the-n-a19c56","errorCode":null,"errorMessage":"Variable name in the body should be equal to the name used in the requested URL.","messagePattern":"Variable name in the body should be equal to the name used in the requested URL\\.","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ProcessInstanceVariableResource.java","lineNumber":105,"sourceCode":"            @ApiImplicitParam(name = \"name\", dataType = \"string\", paramType = \"form\", example = \"Simple content item\"),\n            @ApiImplicitParam(name = \"type\", dataType = \"string\", paramType = \"form\", example = \"integer\"),\n    })\n    @ApiResponses(value = {\n            @ApiResponse(code = 201, message = \"Indicates both the process instance and variable were found and variable is updated.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested process instance was not found or the process instance does not have a variable with the given name. Status description contains additional information about the error.\")\n    })\n    @PutMapping(value = \"/runtime/process-instances/{processInstanceId}/variables/{variableName}\", produces = \"application/json\", consumes = {\"application/json\", \"multipart/form-data\"})\n    public RestVariable updateVariable(@ApiParam(name = \"processInstanceId\") @PathVariable(\"processInstanceId\") String processInstanceId, @ApiParam(name = \"variableName\") @PathVariable(\"variableName\") String variableName,\n            HttpServletRequest request) {\n\n        Execution execution = getExecutionFromRequestWithoutAccessCheck(processInstanceId);\n\n        RestVariable result = null;\n        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            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, execution, false, false);","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ProcessInstanceVariableResource.java#L87-L123","documentation":"Flowable REST throws FlowableIllegalArgumentException when updating a process instance variable if the variable name in the request body (or uploaded file form field) differs from the {variableName} in the URL. Name in body and URL must match exactly.","triggerScenarios":"PUT /runtime/process-instances/{id}/variables/{name} where the multipart file field name or the 'name' property in the JSON body differs from {name} (case-sensitive comparison).","commonSituations":"Copy-pasted request bodies where only the URL was edited; multipart uploads where the form field defaults to 'file' while URL names another variable; case mismatch ('OrderAmount' vs 'orderAmount').","solutions":["Set the body 'name' property (or multipart field name) to exactly the URL variable name.","Regenerate request bodies from the URL instead of reusing old payloads.","Match casing exactly — the comparison is case-sensitive."],"exampleFix":"// PUT /runtime/process-instances/123/variables/orderAmount\n// before\n{\"name\":\"orderamount\",\"type\":\"integer\",\"value\":5}\n// after\n{\"name\":\"orderAmount\",\"type\":\"integer\",\"value\":5}","handlingStrategy":"validation","validationCode":"if (body.name !== urlVariableName) throw new Error('body name must equal URL variable name: ' + urlVariableName);","typeGuard":"const namesMatch = (body, urlName) => body != null && typeof body.name === 'string' && body.name === urlName;","tryCatchPattern":null,"preventionTips":["Generate the body from the same variable constant used in the URL","For multipart uploads, set the form field name to the URL variable name","Watch for case mismatches"],"tags":["rest-api","validation","variables"],"backgroundTag":"invalid-argument-value","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"}