signalapp/Signal-Server · error · JsonParseException

Could not parse identity key as a base64-encoded value

Error message

Could not parse identity key as a base64-encoded value

What it means

Thrown by IdentityKeyAdapter.Deserializer when the JSON string value of an identity-key field fails Base64 decoding: Base64.getDecoder().decode throws IllegalArgumentException, which is caught and rethrown as a JsonParseException. The faulting input is the identity key JSON property, which must be standard Base64 of the serialized IdentityKey bytes.

Solutions

  1. Ensure the identity key JSON value is a valid standard-Base64 string
  2. Verify the client encodes the IdentityKey with Base64.getEncoder().encodeToString(identityKey.serialize())
  3. Check the payload is not empty, hex-encoded, or URL-safe Base64
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at service/src/main/java/org/whispersystems/textsecuregcm/util/IdentityKeyAdapter.java:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at service/src/main/java/org/whispersystems/textsecuregcm/util/IdentityKeyAdapter.java:42

    @Override
    public void serialize(final IdentityKey identityKey,
        final JsonGenerator jsonGenerator,
        final SerializerProvider serializers) throws IOException {

      jsonGenerator.writeString(Base64.getEncoder().encodeToString(identityKey.serialize()));
    }
  }

  public static class Deserializer extends JsonDeserializer<IdentityKey> {

    @Override
    public IdentityKey deserialize(final JsonParser parser, final DeserializationContext context) throws IOException {
      final byte[] identityKeyBytes;

      try {
        identityKeyBytes = Base64.getDecoder().decode(parser.getValueAsString());
      } catch (final IllegalArgumentException e) {
        throw new JsonParseException(parser, "Could not parse identity key as a base64-encoded value", e);
      }

      if (identityKeyBytes.length == 0) {
        return null;
      }

      try {
        return new IdentityKey(identityKeyBytes);
      } catch (final InvalidKeyException e) {
        throw new JsonParseException(parser, "Could not interpret identity key bytes as an EC public key", e);
      }
    }
  }
}

View on GitHub (pinned to 100ab61c82)