apache/beam · error · UnsupportedOperationException

Unsupported file pattern. Only file patterns with 'gs://'…

Error message

Unsupported file pattern. Only file patterns with 'gs://' schema are supported at the moment.

What it means

GcsTableFactory.tableBuilder throws this when the single file pattern in the Data Catalog entry's GCS fileset spec does not start with 'gs://'. Only Google Cloud Storage patterns are supported by this provider.

Solutions

  1. Change the entry's file pattern to a gs:// URI, e.g. gs://bucket/path/*.json
  2. Verify the file pattern string in the Data Catalog entry has no leading whitespace or wrong scheme
  3. Use a different Beam SQL provider if the data is not on GCS

Example fix

// before
file_patterns: ['/data/events/*.json']
// after
file_patterns: ['gs://my-bucket/data/events/*.json']
Defensive patterns

Strategy: validation

Validate before calling

String p = entry.getGcsFilesetSpec().getFilePatterns(0);
if (!p.startsWith("gs://")) throw new IllegalArgumentException("Pattern must start with gs://: " + p);

Type guard

static boolean isGcsPattern(String p) { return p != null && p.startsWith("gs://"); }

Try / catch

try {
  Table t = gcsFactory.tableBuilder(entry).get();
} catch (UnsupportedOperationException ex) {
  LOG.error("Only gs:// patterns supported", ex);
}

Prevention

When it happens

Trigger: tableBuilder receives a filePattern whose value does not begin with 'gs://', e.g. 's3://bucket/x' or a bare path '/data/x.json'.

Common situations: Entries authored for another storage system, local paths pasted into file_patterns, or a URI missing the gs:// scheme.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/2c7f83edc0ee6867. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/GcsTableFactory.java:49

  @Override
  public Optional<Table.Builder> tableBuilder(Entry entry) {
    if (!entry.hasGcsFilesetSpec()) {
      return Optional.empty();
    }

    GcsFilesetSpec gcsFilesetSpec = entry.getGcsFilesetSpec();
    List<String> filePatterns = gcsFilesetSpec.getFilePatternsList();

    // We support exactly one 'file_patterns' field and nothing else at the moment
    if (filePatterns.size() != 1) {
      throw new UnsupportedOperationException(
          "Unable to parse GCS entry '" + entry.getName() + "'");
    }

    String filePattern = filePatterns.get(0);

    if (!filePattern.startsWith("gs://")) {
      throw new UnsupportedOperationException(
          "Unsupported file pattern. "
              + "Only file patterns with 'gs://' schema are supported at the moment.");
    }

    return Optional.of(
        Table.builder()
            .type("text")
            .location(filePattern)
            .properties(TableUtils.emptyProperties())
            .comment(""));
  }
}

View on GitHub (pinned to 12126d8942)