apache/shardingsphere · error · UnsupportedOperationException

not support unpack the type %s

Error message

not support unpack the type %s

What it means

The CDC client converts google.protobuf.Any values from the server into Java objects. After checking all supported wrappers (int32, string, bytes, Timestamp, Struct, ...), an unrecognized type URL logs the value and throws UnsupportedOperationException with the type URL, because the client has no faithful conversion for that column type.

Source

Thrown at kernel/data-pipeline/scenario/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverter.java:94

        }
        if (any.is(DoubleValue.class)) {
            return any.unpack(DoubleValue.class).getValue();
        }
        if (any.is(BoolValue.class)) {
            return any.unpack(BoolValue.class).getValue();
        }
        if (any.is(BytesValue.class)) {
            return any.unpack(BytesValue.class).getValue().toByteArray();
        }
        if (any.is(com.google.protobuf.Timestamp.class)) {
            return converProtobufTimestamp(any.unpack(com.google.protobuf.Timestamp.class));
        }
        if (any.is(Struct.class)) {
            return JsonFormat.printer().print(any.unpack(Struct.class));
        }
        // TODO can't use JsonFormat, might change the original value without error prompt. there need to cover more types,
        log.error("not support unpack value={}", any);
        throw new UnsupportedOperationException(String.format("not support unpack the type %s", any.getTypeUrl()));
    }
    
    private static Timestamp converProtobufTimestamp(final com.google.protobuf.Timestamp timestamp) {
        Timestamp result = new Timestamp(timestamp.getSeconds() * 1000L);
        result.setNanos(timestamp.getNanos());
        return result;
    }
}

View on GitHub (pinned to e952770a21)

Solutions

  1. Align CDC client jar version with the ShardingSphere proxy/server version so both sides support the same Any wrapper set.
  2. Identify the column and type URL from the log line ('not support unpack value=...') and exclude or alter that column in the CDC subscription if it is not needed.
  3. If the type is required, extend ProtobufAnyValueConverter locally to unpack that wrapper and rebuild the client.
  4. Report the missing type upstream so the converter gains coverage.
Defensive patterns

Strategy: type-guard

Type guard

private static final Set<String> SUPPORTED_ANY_TYPES = Set.of(
    "type.googleapis.com/google.protobuf.Int32Value",
    "type.googleapis.com/google.protobuf.StringValue",
    "type.googleapis.com/google.protobuf.BytesValue",
    "type.googleapis.com/google.protobuf.Timestamp",
    "type.googleapis.com/google.protobuf.Struct");

static boolean isSupported(Any any) { return SUPPORTED_ANY_TYPES.contains(any.getTypeUrl()); }

Try / catch

try {
    Object v = ProtobufAnyValueConverter.convert(any);
} catch (final UnsupportedOperationException ex) {
    log.warn("Unsupported Any type {}, skipping column", any.getTypeUrl());
}

Prevention

When it happens

Trigger: A CDC-subscribed table contains a column whose protobuf Any wrapper type is outside the converter's supported set, and a row event for that table is delivered to the client; any.unpack is then impossible and the converter throws.

Common situations: Newer ShardingSphere server sending a newer Any wrapper type than the client jar understands (client/server version skew); exotic column types (e.g. specific numeric or temporal wrappers) not yet covered by ProtobufAnyValueConverter; the TODO in the source notes coverage is incomplete.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/3163619c2543b3b2. Report an issue: GitHub.