apache/pulsar · error · IllegalArgumentException

Unable to convert digest type ${digestType}

Error message

Unable to convert digest type ${digestType}

What it means

When building an OffloadIndexBlock from LedgerMetadata, the builder converts the ledger digest type (BookKeeper DigestType) to the protocol-level DigestType for serialization. An unrecognized enum value hits the default branch and throws IllegalArgumentException('Unable to convert digest type ...'), meaning the offload code does not support that digest type.

Source

Thrown at tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/OffloadIndexBlockImpl.java:261

        @Override
        public long getLength() {
            return this.length;
        }

        @Override
        public DigestType getDigestType() {
            switch (this.digestType) {
                case HMAC:
                    return DigestType.MAC;
                case CRC32:
                    return DigestType.CRC32;
                case CRC32C:
                    return DigestType.CRC32C;
                case DUMMY:
                    return DigestType.DUMMY;
                default:
                    throw new IllegalArgumentException("Unable to convert digest type " + digestType);
            }
        }

        @Override
        public long getCtime() {
            return this.ctime;
        }

        @Override
        public boolean isClosed() {
            return this.state == State.CLOSED;
        }

        @Override
        public Map<String, byte[]> getCustomMetadata() {
            return this.customMetadata;
        }

View on GitHub (pinned to 820761864e)

Solutions

  1. Reconfigure the ledger digest type to a supported value (CRC32, CRC32C, or DUMMY) and write new ledgers, then offload those
  2. Upgrade the Pulsar/BookKeeper jcloud offload module to a version supporting the digest type in use
  3. Prevent offload for unsupported-digest ledgers (e.g. exclude them from offload policies)
  4. Check bookkeeper digests enabled on the cluster and align with the offload module's supported set

Example fix

// before: offloading a MAC-digest ledger
broker.conf: managedLedgerMaxEntriesPerLedger=... digestType=MAC
// after: use a supported digest for offloadable ledgers
digestType=CRC32C
Defensive patterns

Strategy: validation

Validate before calling

DigestType dt = ledgerMetadata.getDigestType();
Set<DigestType> supported = Set.of(DigestType.CRC32, DigestType.CRC32C, DigestType.DUMMY);
if (!supported.contains(dt)) {
    throw new IllegalArgumentException("Digest type not offloadable: " + dt);
}

Try / catch

try {
    OffloadIndexBlock idx = builder.withLedgerMetadata(meta, ctime).build();
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unable to convert digest type")) {
        // exclude this ledger from offload or change digest type
    } else { throw e; }
}

Prevention

When it happens

Trigger: Offloading a ledger whose LedgerMetadata digest type is not CRC32, CRC32C, or DUMMY — e.g. MAC/HMAC digest ledgers or a newer BookKeeper digest type added after this offload implementation was written.

Common situations: Brokers configured with digestType=MAC (or a newer digest) attempting tiered storage offload; upgrading BookKeeper to add a digest type while the jcloud offload module is older; misconfigured bookkeeper.conf digest type.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/ab89fdc0a0c143e5. Report an issue: GitHub.