flowable/flowable-engine · error · FlowableObjectNotFoundException

The user with id ' ' does not have a picture.

Error message

The user with id '${userId}' does not have a picture.

What it means

FlowableObjectNotFoundException thrown by getUserPicture (GET /identity/users/{userId}/picture) when identityService.getUserPicture(userId) returns null — the user exists but has never been assigned a picture. The resource type in the exception is Picture.class, signaling callers that the missing entity is the picture, not the user.

Solutions

  1. Check for a 404 response on the picture endpoint and render a default avatar instead.
  2. Upload a picture first via PUT identity/users/{userId}/picture (multipart/form-data with a single file part).
  3. Confirm the correct userId — pictures are per-user and not shared.
  4. Use the identityService.setUserPicture(userId, picture) API server-side if provisioning users programmatically.

Example fix

// before
const res = await fetch(`/identity/users/${userId}/picture`);
const blob = await res.blob(); // throws/unhandled on 404

// after
const res = await fetch(`/identity/users/${userId}/picture`);
if (res.status === 404) {
  return DEFAULT_AVATAR;
}
return await res.blob();
Defensive patterns

Strategy: fallback

Validate before calling

// no cheap pre-check via API besides listing; guard by handling 404
const res = await fetch(`/identity/users/${userId}/picture`);
if (res.status === 404) {
  return DEFAULT_AVATAR;
}

Try / catch

try {
  const res = await fetch(`/identity/users/${userId}/picture`);
  if (res.status === 404) return DEFAULT_AVATAR; // FlowableObjectNotFoundException: no picture
  return await res.blob();
} catch (e) {
  return DEFAULT_AVATAR;
}

Prevention

When it happens

Trigger: Requesting GET identity/users/{userId}/picture for a user created without a picture, or before PUT .../picture (upload) has ever been called, or after the picture was deleted/reset to null.

Common situations: Frontends that unconditionally render avatar endpoints for all users; users migrated from another identity store without picture blobs; freshly provisioned accounts in test environments; consuming a 404 with resource type 'Picture' and confusing it with 'user not found'.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserPictureResource.java:66

 */
@RestController
@Api(tags = { "Users" }, authorizations = { @Authorization(value = "basicAuth") })
public class UserPictureResource extends BaseUserResource {


    @ApiOperation(value = "Get a user’s picture", produces = "application/octet-stream", tags = {
            "Users" }, notes = "The response body contains the raw picture data, representing the user’s picture. The Content-type of the response corresponds to the mimeType that was set when creating the picture.")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates the user was found and has a picture, which is returned in the body."),
            @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have a profile picture. Status-description contains additional information about the error.")
    })
    @GetMapping(value = "/identity/users/{userId}/picture")
    public ResponseEntity<byte[]> getUserPicture(@ApiParam(name = "userId") @PathVariable String userId) {
        User user = getUserFromRequest(userId);
        Picture userPicture = identityService.getUserPicture(user.getId());

        if (userPicture == null) {
            throw new FlowableObjectNotFoundException("The user with id '" + user.getId() + "' does not have a picture.", Picture.class);
        }

        HttpHeaders responseHeaders = new HttpHeaders();
        if (userPicture.getMimeType() != null) {
            responseHeaders.set("Content-Type", userPicture.getMimeType());
        } else {
            responseHeaders.set("Content-Type", "image/jpeg");
        }

        try {
            return new ResponseEntity<>(IOUtils.toByteArray(userPicture.getInputStream()), responseHeaders, HttpStatus.OK);
        } catch (Exception e) {
            throw new FlowableException("Error exporting picture: " + e.getMessage(), e);
        }
    }

    @ApiOperation(consumes = "multipart/form-data", value = "Updating a user’s picture", tags = {
            "Users" },  notes = "The request should be of type multipart/form-data. There should be a single file-part included with the binary value of the picture. On top of that, the following additional form-fields can be present:\n"

View on GitHub (pinned to d6d39ce1c6)