apache/beam · error · RuntimeException
Export cannot be executed because export URI (%s) is not fro
Error message
Export cannot be executed because export URI (%s) is not from GCS or BigQuery.
What it means
FhirIO's export step only supports exporting a FHIR store to Google Cloud Storage (gs://) or BigQuery (bq://) destinations, as defined by the GCS_PREFIX and BQ_PREFIX checks. When the configured export URI has any other scheme, no corresponding Healthcare API client method exists, so a RuntimeException is thrown with the offending URI. This is a configuration-time guard against unsupported destinations.
Source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java:1721
}
@Setup
public void initClient() throws IOException {
this.client = new HttpHealthcareApiClient();
}
@ProcessElement
public void exportResources(ProcessContext context) throws IOException, InterruptedException {
final String fhirStore = context.element();
final String exportUri = this.exportUri.get();
Operation operation;
if (exportUri.startsWith(GCS_PREFIX)) {
operation = client.exportFhirResourceToGcs(fhirStore, exportUri);
} else if (exportUri.startsWith(BQ_PREFIX)) {
operation = client.exportFhirResourceToBigQuery(fhirStore, exportUri);
} else {
throw new RuntimeException(
String.format(
"Export cannot be executed because export URI (%s) is not from GCS or BigQuery.",
exportUri));
}
operation = client.pollOperation(operation, 15000L);
incrementLroCounters(
operation,
EXPORT_OPERATION_SUCCESS,
EXPORT_OPERATION_ERRORS,
RESOURCES_EXPORTED_SUCCESS,
RESOURCES_EXPORTED_ERRORS);
if (operation.getError() != null) {
throw new RuntimeException(
String.format(
"Export operation (%s) failed. Reason: %s",
operation.getName(), operation.getError().getMessage()));
}View on GitHub (pinned to 12126d8942)
Solutions
- Set the export URI to a GCS location, e.g. gs://my-bucket/fhir-export/
- For BigQuery, use a bq:// URI in the form bq://my-project.my_dataset.my_table
- Check for typos in the scheme (gs:// not gcs://) and that no whitespace or quotes corrupt the prefix
- If a non-GCS/BQ sink is truly needed, export to GCS first and add a downstream transform to move the data
Example fix
// before
FhirIO.export("https://storage.example.com/export") // throws
// after
FhirIO.export("gs://my-bucket/fhir-export") Defensive patterns
Strategy: validation
Validate before calling
if (!exportUri.startsWith("gs://") && !exportUri.startsWith("bq://")) {
throw new IllegalArgumentException("exportUri must be a gs:// or bq:// URI: " + exportUri);
} Try / catch
try {
// run export
} catch (RuntimeException e) {
if (e.getMessage().contains("not from GCS or BigQuery")) {
LOG.error("Fix exportUri scheme: {}", exportUri);
} else throw e;
} Prevention
- Store export destinations as gs:// or bq:// URIs in config validated at startup
- Watch for typo'd schemes (gcs://) and missing prefixes
- Add a config-lint unit test for destination URIs
When it happens
Trigger: Calling FhirIO.export with an exportUri that does not start with "gs://" or "bq://" — e.g. an https:// URL, a local file path like /tmp/export, or a misspelled scheme such as gcs://.
Common situations: Using a path copied from another tool (HDFS, local disk); forgetting the scheme entirely; assuming BigQuery URIs take dataset/table form that doesn't match the expected bq:// prefix; typo gcs:// instead of gs://.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- BigQuery temp location expected a valid 'gs://' path, but wa
- BigQuery temp location expected a valid 'gs://' path, but wa
- Not all temporary files are present for importing.
- Export operation (%s) failed. Reason: %s
- Unable to read file(s) after retrying %d times
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/0a6d861e6bebf2b7.
Report an issue: GitHub.