{"record":{"id":"9c59db18e9e82824","repo":"signalapp/Signal-Server","slug":"could-not-interpret-bytes-as-a-backupauth-object","errorCode":null,"errorMessage":"Could not interpret bytes as a BackupAuth object","messagePattern":"Could not interpret bytes as a BackupAuth object","errorType":"validation","errorClass":"JsonParseException","httpStatus":400,"severity":"error","filePath":"service/src/main/java/org/whispersystems/textsecuregcm/util/BackupAuthCredentialAdapter.java","lineNumber":50,"sourceCode":"  abstract static class GenericDeserializer<T> extends JsonDeserializer<T> {\n\n    abstract T deserialize(final byte[] bytes) throws InvalidInputException;\n\n    @Override\n    public T deserialize(final JsonParser parser, final DeserializationContext deserializationContext)\n        throws IOException {\n      final byte[] bytes;\n      try {\n        bytes = Base64.getDecoder().decode(parser.getValueAsString());\n      } catch (final IllegalArgumentException e) {\n        INVALID_BASE64_COUNTER.increment();\n        throw new JsonParseException(parser, \"Could not parse string as a base64-encoded value\", e);\n      }\n      try {\n        return deserialize(bytes);\n      } catch (InvalidInputException e) {\n        INVALID_BYTES_COUNTER.increment();\n        throw new JsonParseException(parser, \"Could not interpret bytes as a BackupAuth object\");\n      }\n    }\n  }\n\n  static class GenericSerializer<T extends ByteArray> extends JsonSerializer<T> {\n\n    @Override\n    public void serialize(final T t, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)\n        throws IOException {\n      jsonGenerator.writeString(Base64.getEncoder().encodeToString(t.serialize()));\n    }\n  }\n\n  public static class CredentialRequestSerializer extends GenericSerializer<BackupAuthCredentialRequest> {}\n  public static class CredentialRequestDeserializer extends GenericDeserializer<BackupAuthCredentialRequest> {\n    @Override\n    BackupAuthCredentialRequest deserialize(final byte[] bytes) throws InvalidInputException {\n      return new BackupAuthCredentialRequest(bytes);","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/signalapp/Signal-Server/blob/100ab61c82627582c867d19e1c0561ba2781e927/service/src/main/java/org/whispersystems/textsecuregcm/util/BackupAuthCredentialAdapter.java#L32-L68","documentation":"Thrown by BackupAuthCredentialAdapter's GenericDeserializer when Base64 decoding succeeds but the abstract deserialize(bytes) call raises InvalidInputException because the bytes are not a valid BackupAuth object (wrong structure, version, or length). The failure is counted via INVALID_BYTES_COUNTER and rethrown as a JsonParseException, failing deserialization of the field.","triggerScenarios":"Thrown at service/src/main/java/org/whispersystems/textsecuregcm/util/BackupAuthCredentialAdapter.java:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the Base64-decoded bytes form a valid BackupAuth credential object in the expected format","Confirm the client serializes the BackupAuth object (e.g. via serialize()) before Base64-encoding it","Check for corrupted or version-mismatched credential bytes in the request"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"100ab61c82627582c867d19e1c0561ba2781e927","analyzedAt":"2026-09-09T13:29:47.883Z","contentChangedAt":"2026-09-09T13:29:47.883Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}