signalapp/Signal-Server · error · FieldValidationException

string expected to be non-empty

Error message

string expected to be non-empty

What it means

NonEmptyFieldValidator.validateStringValue throws FieldValidationException when a proto field annotated as required-non-empty is null or empty (StringUtils.isNotEmpty fails). The Signal gRPC layer runs these validators on incoming requests so malformed/empty required fields are rejected at the boundary.

Solutions

  1. Set the field to a non-empty string before sending the request
  2. On the client, skip sending the request if the value is null/blank and surface a user-facing error
  3. Check the proto annotations to confirm which fields are marked non-empty and ensure all are populated

Example fix

// before
AccountIdentifierRequest.newBuilder().setAcifield("").build();
// after
if (aci != null && !aci.isBlank()) {
  req = AccountIdentifierRequest.newBuilder().setAcifield(aci).build();
}
Defensive patterns

Strategy: validation

Validate before calling

if (value == null || value.isBlank()) throw new IllegalArgumentException("field must be a non-empty string");

Type guard

boolean isNonEmpty(String s) { return s != null && !s.isBlank(); }

Try / catch

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

Prevention

When it happens

Trigger: Calling a Signal gRPC endpoint with a request whose non-empty-string field is null, "" or (per StringUtils.isNotEmpty) not set; e.g. an empty account identifier, device name, or message field.

Common situations: Clients constructing protobuf requests with default/omitted string fields; partial migrations where a previously optional field became required; test clients sending empty placeholders.

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/ede606dc52f4bc52. Report an issue: GitHub.

Appendix: source

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

  @Override
  protected void validateBytesValue(
      final Boolean extensionValue,
      final ByteString fieldValue) throws FieldValidationException {
    if (!fieldValue.isEmpty()) {
      return;
    }
    throw new FieldValidationException("byte array expected to be non-empty");
  }

  @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)