signalapp/Signal-Server · error · FieldValidationException

enum field must be specified

Error message

enum field must be specified

What it means

EnumSpecifiedFieldValidator requires proto enum fields to be explicitly set to a non-zero value. Proto3 uses index 0 as the default/unknown value, so if the enum descriptor index is <= 0 the field was left unspecified and FieldValidationException('enum field must be specified') is thrown.

Solutions

  1. Explicitly set the enum field to a meaningful (non-first) value in the request builder before sending
  2. Check the generated code so you are not reading/writing the wrong enum field name
  3. If the value is genuinely 'unspecified', use an endpoint or proto that makes the field optional instead

Example fix

// before
DonationReceiptData.newBuilder().setAmount(amount).build();
// after
DonationReceiptData.newBuilder().setAmount(amount).setPaymentDetailType(PaymentDetailType.PAYPAL).build();
Defensive patterns

Strategy: validation

Validate before calling

if (request.getPaymentDetailType() == PaymentDetailType.UNRECOGNIZED || request.getPaymentDetailTypeValue() == 0) {
  throw new IllegalStateException("enum field must be set to a non-default value before sending");
}

Type guard

static <E extends Enum<E>> boolean isSet(E value) { return value != null && value.ordinal() != 0; }

Try / catch

try {
  grpcStub.call(request);
} catch (StatusRuntimeException e) {
  if (e.getStatus().getCode() == Code.INVALID_ARGUMENT && e.getStatus().getDescription().contains("must be specified")) {
    // prompt user for the missing enum value
  }
}

Prevention

When it happens

Trigger: gRPC requests where a required enum field is left at its default (first) enum value or is unset, e.g. omitting a donation/receipt type enum in the request proto.

Common situations: Client code forgetting to set the enum field (proto3 silently defaults to 0); protobuf library versions that map unknown values to the first enum; generated-code handling that skips explicitly setting enum values.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of signalapp/Signal-Server@100ab61c82 (2026-09-09). Data as JSON: /api/errors/143e3d267c5852c7. Report an issue: GitHub.

Appendix: source

Thrown at service/src/main/java/org/whispersystems/textsecuregcm/grpc/validators/EnumSpecifiedFieldValidator.java:27

import java.util.Set;

public class EnumSpecifiedFieldValidator extends FieldValidator<Boolean> {

  public EnumSpecifiedFieldValidator() {
    super("specified", Set.of(Descriptors.FieldDescriptor.Type.ENUM), MissingOptionalAction.FAIL, false);
  }

  @Override
  protected Boolean resolveExtensionValue(final Object extensionValue) throws FieldValidationException {
    return requireFlagExtension(extensionValue);
  }

  @Override
  protected void validateEnumValue(
      final Boolean extensionValue,
      final Descriptors.EnumValueDescriptor enumValueDescriptor) throws FieldValidationException {
    if (enumValueDescriptor.getIndex() <= 0) {
      throw new FieldValidationException("enum field must be specified");
    }
  }
}

View on GitHub (pinned to 100ab61c82)