signalapp/Signal-Server · error · FieldValidationException

repeated field is expected to be non-empty

Error message

repeated field is expected to be non-empty

What it means

NonEmptyFieldValidator.validateRepeatedField throws FieldValidationException when a repeated proto field marked required-non-empty has zero elements. It ensures list-type fields passed to Signal gRPC endpoints actually contain at least one item.

Solutions

  1. Populate at least one element in the repeated field before building the request
  2. Guard client-side: bail out early if the list is empty instead of issuing the call
  3. If empty batches are legitimate, remove the non-empty annotation server-side

Example fix

// before
if (ids.isEmpty()) { /* still sends request */ }
grpcStub.update(requestBuilder.addAllIds(ids).build());
// after
if (!ids.isEmpty()) {
  grpcStub.update(requestBuilder.addAllIds(ids).build());
}
Defensive patterns

Strategy: validation

Validate before calling

if (list == null || list.isEmpty()) throw new IllegalArgumentException("repeated field must contain at least one element");

Type guard

boolean isNonEmptyList(List<?> l) { return l != null && !l.isEmpty(); }

Try / catch

try { stub.call(request); } catch (StatusRuntimeException e) { if (e.getStatus().getCode() == Status.Code.INVALID_ARGUMENT) { /* handle empty list */ } }

Prevention

When it happens

Trigger: Sending a request to a Signal gRPC method where a required repeated field (e.g. a list of identifiers, devices, or messages) is empty or unset.

Common situations: Batch APIs called with nothing to process; clients building requests in loops that processed zero items; filters that removed all elements before the request was built.

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 signalapp/Signal-Server@100ab61c82 (2026-09-09). Data as JSON: /api/errors/726ebb5294eca488. Report an issue: GitHub.

Appendix: source

Thrown at service/src/main/java/org/whispersystems/textsecuregcm/grpc/validators/NonEmptyFieldValidator.java:56

  @Override
  protected void validateStringValue(
      final Boolean extensionValue,
      final String fieldValue) throws FieldValidationException {
    if (StringUtils.isNotEmpty(fieldValue)) {
      return;
    }
    throw new FieldValidationException("string expected to be non-empty");
  }

  @Override
  protected void validateRepeatedField(
      final Boolean extensionValue,
      final Descriptors.FieldDescriptor fd,
      final List<?> repeated) throws FieldValidationException {
    if (repeated.size() > 0) {
      return;
    }
    throw new FieldValidationException("repeated field is expected to be non-empty");
  }
}

View on GitHub (pinned to 100ab61c82)