flowable/flowable-engine · error · FlowableIllegalArgumentException

AttachmentRequest properties not found in request

Error message

AttachmentRequest properties not found in request

What it means

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").

Solutions

  1. Include attachment properties in the JSON body: {"name":"...","description":"...","externalUrl":"..."}.
  2. Ensure the client actually transmits the body (verify with curl -v).
  3. Set Content-Type: application/json.
  4. If uploading content, prefer the binary/multipart attachment endpoint.

Example fix

// before
curl -X POST -H 'Content-Type: application/json' .../tasks/123/attachments

// after
curl -X POST -H 'Content-Type: application/json' \
  -d '{"name":"spec","description":"Design spec"}' .../tasks/123/attachments
Defensive patterns

Strategy: validation

Validate before calling

if (!payload || !payload.name) throw new Error('Attachment POST requires at least a name property');

Type guard

function hasAttachmentProps(v) { return v !== null && v !== undefined && typeof v === 'object' && Object.keys(v).length > 0; }

Try / catch

try {
  await api.post(url, payload);
} catch (e) {
  if (/AttachmentRequest properties not found/.test(e.response?.data?.message || '')) {
    // body never arrived; resend with JSON payload
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: Clients calling the endpoint without -d/--data, gateways dropping bodies, tests that build the request but never attach content, 'Content-Length: 0' POSTs.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/226ab74dc35d865d. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskAttachmentCollectionResource.java:117

        AttachmentResponse result = null;
        Task task = getTaskFromRequestWithoutAccessCheck(taskId);
        if (restApiInterceptor != null) {
            restApiInterceptor.createTaskAttachment(task);
        }
        if (request instanceof MultipartHttpServletRequest) {
            result = createBinaryAttachment((MultipartHttpServletRequest) request, task);
        } else {

            AttachmentRequest attachmentRequest = null;
            try {
                attachmentRequest = objectMapper.readValue(request.getInputStream(), AttachmentRequest.class);

            } catch (Exception e) {
                throw new FlowableIllegalArgumentException("Failed to serialize to a AttachmentRequest instance", e);
            }

            if (attachmentRequest == null) {
                throw new FlowableIllegalArgumentException("AttachmentRequest properties not found in request");
            }

            result = createSimpleAttachment(attachmentRequest, task);
        }

        return result;
    }

    protected AttachmentResponse createSimpleAttachment(AttachmentRequest attachmentRequest, Task task) {

        if (attachmentRequest.getName() == null) {
            throw new FlowableIllegalArgumentException("Attachment name is required.");
        }

        Attachment createdAttachment = taskService.createAttachment(attachmentRequest.getType(), task.getId(), task.getProcessInstanceId(), attachmentRequest.getName(),
                attachmentRequest.getDescription(), attachmentRequest.getExternalUrl());

        return restResponseFactory.createAttachmentResponse(createdAttachment);

View on GitHub (pinned to d6d39ce1c6)