{"record":{"id":"8c812fe3ea2e7cd8","repo":"flowable/flowable-engine","slug":"variable-name-in-the-body-should-be-equal-to-the-n","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":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":409,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceVariableResource.java","lineNumber":100,"sourceCode":"            @ApiImplicitParam(name = \"type\", dataType = \"string\", paramType = \"form\", example = \"integer\"),\n    })\n    @ApiResponses(value = {\n            @ApiResponse(code = 201, message = \"Indicates both the case instance and variable were found and variable is updated.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested case instance was not found or the case instance does not have a variable with the given name. Status description contains additional information about the error.\")\n    })\n    @PutMapping(value = \"/cmmn-runtime/case-instances/{caseInstanceId}/variables/{variableName}\", produces = \"application/json\", consumes = {\"application/json\", \"multipart/form-data\"})\n    public RestVariable updateVariable(@ApiParam(name = \"caseInstanceId\") @PathVariable(\"caseInstanceId\") String caseInstanceId, @ApiParam(name = \"variableName\") @PathVariable(\"variableName\") String variableName,\n            HttpServletRequest request) {\n\n        CaseInstance caseInstance = getCaseInstanceFromRequestWithoutAccessCheck(caseInstanceId);\n\n        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));","sourceCodeStart":82,"sourceCodeEnd":118,"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#L82-L118","documentation":"Thrown by updateVariable (PUT on a single case instance variable) when the variable name in the submitted body does not match the variableName taken from the request URL. Flowable enforces this consistency check to prevent ambiguous updates where the body targets a different variable than the endpoint addresses.","triggerScenarios":"PUT /cmmn-runtime/case-instances/{id}/variables/{variableName} where the parsed body (either the multipart binary variable or the JSON RestVariable) has a 'name' field different from {variableName} in the URL.","commonSituations":"Reusing a copy-pasted JSON body from a previous variable update without editing its 'name'; clients that build the body dynamically with one variable but interpolate another name into the URL; renaming a variable in code but not in stored request templates.","solutions":["Make the 'name' field in the request body exactly equal to the variableName segment in the URL.","If you meant to update a different variable, change the URL instead of the body name.","Omit a conflicting name if your client library auto-injects it, then let the URL define the name where the API allows it."],"exampleFix":"// before: URL has 'orderCount' but body says 'quantity'\nPUT /cmmn-runtime/case-instances/case1/variables/orderCount\n{\"name\":\"quantity\",\"value\":5,\"type\":\"integer\"}\n// after: names match\nPUT /cmmn-runtime/case-instances/case1/variables/orderCount\n{\"name\":\"orderCount\",\"value\":5,\"type\":\"integer\"}","handlingStrategy":"validation","validationCode":"if (body.name !== variableName) {\n  throw new Error(`Body name '${body.name}' must equal URL variable name '${variableName}'`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await updateCaseVariable(caseId, variableName, body);\n} catch (e) {\n  if (e.status === 400) { /* align body.name with URL before retry */ }\n  else throw e;\n}","preventionTips":["Generate the body's 'name' field from the same variable used to build the URL.","Never copy-paste variable update bodies without updating 'name'.","Add a client-side assertion that body.name === urlVariableName."],"tags":["rest-api","variables","name-mismatch","validation","flowable"],"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-14T05:17:10.506Z"}