{"record":{"id":"226ab74dc35d865d","repo":"flowable/flowable-engine","slug":"attachmentrequest-properties-not-found-in-request","errorCode":null,"errorMessage":"AttachmentRequest properties not found in request","messagePattern":"AttachmentRequest properties not found in request","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskAttachmentCollectionResource.java","lineNumber":117,"sourceCode":"        AttachmentResponse result = null;\n        Task task = getTaskFromRequestWithoutAccessCheck(taskId);\n        if (restApiInterceptor != null) {\n            restApiInterceptor.createTaskAttachment(task);\n        }\n        if (request instanceof MultipartHttpServletRequest) {\n            result = createBinaryAttachment((MultipartHttpServletRequest) request, task);\n        } else {\n\n            AttachmentRequest attachmentRequest = null;\n            try {\n                attachmentRequest = objectMapper.readValue(request.getInputStream(), AttachmentRequest.class);\n\n            } catch (Exception e) {\n                throw new FlowableIllegalArgumentException(\"Failed to serialize to a AttachmentRequest instance\", e);\n            }\n\n            if (attachmentRequest == null) {\n                throw new FlowableIllegalArgumentException(\"AttachmentRequest properties not found in request\");\n            }\n\n            result = createSimpleAttachment(attachmentRequest, task);\n        }\n\n        return result;\n    }\n\n    protected AttachmentResponse createSimpleAttachment(AttachmentRequest attachmentRequest, Task task) {\n\n        if (attachmentRequest.getName() == null) {\n            throw new FlowableIllegalArgumentException(\"Attachment name is required.\");\n        }\n\n        Attachment createdAttachment = taskService.createAttachment(attachmentRequest.getType(), task.getId(), task.getProcessInstanceId(), attachmentRequest.getName(),\n                attachmentRequest.getDescription(), attachmentRequest.getExternalUrl());\n\n        return restResponseFactory.createAttachmentResponse(createdAttachment);","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskAttachmentCollectionResource.java#L99-L135","documentation":"After successfully deserializing the JSON body, createAttachment checks whether an AttachmentRequest object actually exists. If the parsed result is null (empty body or 'null' literal), Flowable throws FlowableIllegalArgumentException(\"AttachmentRequest properties not found in request\").","triggerScenarios":"POST /runtime/tasks/{taskId}/attachments with an empty body, body 'null', or a body stripped in transit so objectMapper.readValue returns null (readValue of empty/null input).","commonSituations":"Clients calling the endpoint without -d/--data, gateways dropping bodies, tests that build the request but never attach content, 'Content-Length: 0' POSTs.","solutions":["Include attachment properties in the JSON body: {\"name\":\"...\",\"description\":\"...\",\"externalUrl\":\"...\"}.","Ensure the client actually transmits the body (verify with curl -v).","Set Content-Type: application/json.","If uploading content, prefer the binary/multipart attachment endpoint."],"exampleFix":"// before\ncurl -X POST -H 'Content-Type: application/json' .../tasks/123/attachments\n\n// after\ncurl -X POST -H 'Content-Type: application/json' \\\n  -d '{\"name\":\"spec\",\"description\":\"Design spec\"}' .../tasks/123/attachments","handlingStrategy":"validation","validationCode":"if (!payload || !payload.name) throw new Error('Attachment POST requires at least a name property');","typeGuard":"function hasAttachmentProps(v) { return v !== null && v !== undefined && typeof v === 'object' && Object.keys(v).length > 0; }","tryCatchPattern":"try {\n  await api.post(url, payload);\n} catch (e) {\n  if (/AttachmentRequest properties not found/.test(e.response?.data?.message || '')) {\n    // body never arrived; resend with JSON payload\n  }\n}","preventionTips":["Always send a JSON body when creating JSON attachments.","Confirm the request actually carries data (curl -v / network tab).","Use the binary endpoint for content uploads instead of empty JSON posts."],"tags":["rest-api","missing-request-body","attachments","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-18T11:17:12.947Z"}