{"record":{"id":"8571ed830cf2e2d5","repo":"apache/beam","slug":"format-s-not-supported-only-supported-formats-are-s-8571ed","errorCode":null,"errorMessage":"Format %s not supported. Only supported formats are %s","messagePattern":"Format (.+?) not supported\\. Only supported formats are (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubWriteSchemaTransformProvider.java","lineNumber":144,"sourceCode":"            .get(OUTPUT_TAG)\n            .output(new PubsubMessage(valueMapper.apply(payloadRow), messageAttributes));\n      } catch (Exception e) {\n        if (useErrorOutput) {\n          receiver\n              .get(ERROR_TAG)\n              .output(Row.withSchema(errorSchema).addValues(e.toString(), row).build());\n        } else {\n          throw e;\n        }\n      }\n    }\n  }\n\n  @Override\n  public SchemaTransform from(PubsubWriteSchemaTransformConfiguration configuration) {\n    String format = checkArgumentNotNull(configuration.getFormat(), \"Format must be specified\");\n    if (!VALID_DATA_FORMATS.contains(format.toUpperCase())) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Format %s not supported. Only supported formats are %s\", format, VALID_FORMATS_STR));\n    }\n    return new PubsubWriteSchemaTransform(configuration);\n  }\n\n  private static class PubsubWriteSchemaTransform extends SchemaTransform implements Serializable {\n    final PubsubWriteSchemaTransformConfiguration configuration;\n\n    PubsubWriteSchemaTransform(PubsubWriteSchemaTransformConfiguration configuration) {\n      this.configuration = configuration;\n    }\n\n    @Override\n    public PCollectionRowTuple expand(PCollectionRowTuple input) {\n      PubsubWriteSchemaTransformConfiguration.ErrorHandling errorHandling =\n          configuration.getErrorHandling();\n      String errorOutput = errorHandling == null ? null : errorHandling.getOutput();","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubWriteSchemaTransformProvider.java#L126-L162","documentation":"PubsubWriteSchemaTransformProvider.from() throws IllegalArgumentException when the configuration's format is null or not in VALID_DATA_FORMATS (e.g. RAW, JSON, AVRO). This validates the Pubsub write SchemaTransform configuration before building the transform. The message lists the valid formats so the caller can correct it.","triggerScenarios":"Configuring a Pubsub write SchemaTransform (e.g. from YAML/SQL runner) with format \"json \" (case handled via toUpperCase, but typos like \"text\", \"csv\", \"proto\" are not), or omitting format entirely.","commonSituations":"YAML pipeline configs with a mistyped format value; documentation drift after supported formats changed; dynamic config from a variable containing an empty or legacy format string.","solutions":["Set format to one of the supported values (uppercase-insensitive): check VALID_DATA_FORMATS in the provider, e.g. \"RAW\", \"JSON\", \"AVRO\".","Fix the spelling/case in your YAML or config payload and redeploy.","If you need a format not in the list, transform your data to a supported format upstream (e.g. encode to JSON bytes yourself)."],"exampleFix":"// before\nPubsubWriteSchemaTransformConfiguration.newBuilder().setFormat(\"text\").build();\n// after\nPubsubWriteSchemaTransformConfiguration.newBuilder().setFormat(\"JSON\").build();","handlingStrategy":"validation","validationCode":"if (format == null || !Set.of(\"RAW\",\"JSON\",\"AVRO\").contains(format.toUpperCase())) throw new IllegalArgumentException(\"unsupported format: \" + format);","typeGuard":"null","tryCatchPattern":"try { provider.from(config); } catch (IllegalArgumentException e) { LOG.error(\"config error: {}\", e.getMessage()); }","preventionTips":["Keep a constants enum of supported formats and validate configs at load time.","Snapshot-test YAML configs against the provider's VALID_DATA_FORMATS.","Fail fast in CI by constructing all transforms before submitting pipelines."],"tags":["java","pubsub","beam-yaml","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}