apache/beam · error · IllegalArgumentException
Pub/Sub schema type %s is not supported at this time
Error message
Pub/Sub schema type %s is not supported at this time
What it means
PubsubClient.fromPubsubSchema converts a REST (com.google.api.services.pubsub.model) Schema into a Beam Schema. Only types present in schemaTypeToConversionFnMap (AVRO and PROTO) are supported; any other schema type cannot be converted, so an IllegalArgumentException naming the unsupported type is thrown.
Source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubClient.java:568
/** Create {@link com.google.api.services.pubsub.model.Schema} from Schema definition content. */
public abstract void createSchema(
SchemaPath schemaPath, String schemaContent, com.google.pubsub.v1.Schema.Type type)
throws IOException;
/** Delete {@link SchemaPath}. */
public abstract void deleteSchema(SchemaPath schemaPath) throws IOException;
/** Return {@link SchemaPath} from {@link TopicPath} if exists. */
public abstract @Nullable SchemaPath getSchemaPath(TopicPath topicPath) throws IOException;
/** Return a Beam {@link Schema} from the Pub/Sub schema resource, if exists. */
public abstract Schema getSchema(SchemaPath schemaPath) throws IOException;
/** Convert a {@link com.google.api.services.pubsub.model.Schema} to a Beam {@link Schema}. */
static Schema fromPubsubSchema(com.google.api.services.pubsub.model.Schema pubsubSchema) {
if (!schemaTypeToConversionFnMap.containsKey(pubsubSchema.getType())) {
throw new IllegalArgumentException(
String.format(
"Pub/Sub schema type %s is not supported at this time", pubsubSchema.getType()));
}
SerializableFunction<String, Schema> definitionToSchemaFn =
checkStateNotNull(schemaTypeToConversionFnMap.get(pubsubSchema.getType()));
String definition =
checkNotNull(pubsubSchema.getDefinition(), "Pub/Sub schema definition is null");
return definitionToSchemaFn.apply(definition);
}
/** Convert a {@link com.google.pubsub.v1.Schema} to a Beam {@link Schema}. */
static Schema fromPubsubSchema(com.google.pubsub.v1.Schema pubsubSchema) {
String typeName = pubsubSchema.getType().name();
if (!schemaTypeToConversionFnMap.containsKey(typeName)) {
throw new IllegalArgumentException(
String.format("Pub/Sub schema type %s is not supported at this time", typeName));
}
SerializableFunction<String, Schema> definitionToSchemaFn =View on GitHub (pinned to 12126d8942)
Solutions
- Change the topic's schema to AVRO (or a supported PROTO type)
- Upgrade Beam to a version whose schemaTypeToConversionFnMap includes the schema type
- Read without schema resolution (plain PubsubIO.read) and parse bytes manually
- Delete/recreate the schema resource attached to the topic with a supported type
Example fix
// before gcloud pubsub schemas create my-schema --type=unsupported-type --definition=file.json // after gcloud pubsub schemas create my-schema --type=AVRO --definition=file.avsc
Defensive patterns
Strategy: try-catch
Validate before calling
if (!"AVRO".equals(pubsubSchema.getType()) && !"PROTOCOL_BUFFER".equals(pubsubSchema.getType())) {
throw new IllegalArgumentException("Unsupported Pub/Sub schema type: " + pubsubSchema.getType());
} Try / catch
try { Schema s = PubsubClient.fromPubsubSchema(restSchema); } catch (IllegalArgumentException e) { /* use non-schema read path */ } Prevention
- Use AVRO schemas on topics read with schema-aware PubsubIO
- Keep Beam up to date with supported schema types
- Confirm schema type before wiring schema-aware reads
- Avoid exotic/custom schema types on Beam-consumed topics
When it happens
Trigger: Reading from a Pub/Sub topic with a schema whose type is not in schemaTypeToConversionFnMap, e.g. a schema of type other than AVRO/PROTO, when PubsubIO resolves the topic schema (readWithSchema / schema-aware reads).
Common situations: Topic schema created with a newer/experimental Pub/Sub schema type; schema changed on the topic after the pipeline was written; using a protocol-buffer schema variant that the Beam version in use does not map.
Related errors
- Local timestamp (micros) can only be used with an underlying
- Reserved field name <field.name()> in user schema.
- RECORD/STRUCT are not primitive types
- Unknown BigQuery type: " + bqType
- Unknown BigQuery Field Mode: %s
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6a33a50bb3ec53a4.
Report an issue: GitHub.