{"record":{"id":"47cf4fb43f71e04b","repo":"apache/beam","slug":"bigquery-temp-location-expected-a-valid-gs-path-but-was-47cf4f","errorCode":null,"errorMessage":"BigQuery temp location expected a valid 'gs://' path, but was given '%s'","messagePattern":"BigQuery temp location expected a valid 'gs://' path, but was given '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java","lineNumber":1443,"sourceCode":"\n    @Override\n    public void validate(@Nullable PipelineOptions maybeOptions) {\n      PipelineOptions options = checkArgumentNotNull(maybeOptions);\n      // Even if existence validation is disabled, we need to make sure that the BigQueryIO\n      // read is properly specified.\n      BigQueryOptions bqOptions = options.as(BigQueryOptions.class);\n\n      if (getMethod() != TypedRead.Method.DIRECT_READ) {\n        String tempLocation = bqOptions.getTempLocation();\n        checkArgument(\n            !Strings.isNullOrEmpty(tempLocation),\n            \"BigQueryIO.Read needs a GCS temp location to store temp files.\"\n                + \"This can be set with option --tempLocation.\");\n        if (getBigQueryServices() == null) {\n          try {\n            GcsPath.fromUri(tempLocation);\n          } catch (IllegalArgumentException e) {\n            throw new IllegalArgumentException(\n                String.format(\n                    \"BigQuery temp location expected a valid 'gs://' path, but was given '%s'\",\n                    tempLocation),\n                e);\n          }\n        }\n        checkArgument(\n            getBadRecordRouter().equals(BadRecordRouter.THROWING_ROUTER),\n            \"BigQueryIO Read with Error Handling is only available when DIRECT_READ is used\");\n      }\n\n      ValueProvider<TableReference> table = getTableProvider();\n      ValueProvider<String> query = getQuery();\n\n      // Note that a table or query check can fail if the table or dataset are created by\n      // earlier stages of the pipeline or if a query depends on earlier stages of a pipeline.\n      // For these cases the withoutValidation method can be used to disable the check.\n      if (getValidate()) {","sourceCodeStart":1425,"sourceCodeEnd":1461,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java#L1425-L1461","documentation":"BigQueryIO.Read.validate checks pipeline options before running: for non-DIRECT_READ methods the job needs a GCS temp location (BigQueryOptions.getTempLocation()) to stage intermediate results. An empty, null, or non-'gs://' tempLocation fails this checkArgument — the pipeline cannot read from BigQuery without valid GCS temp storage.","triggerScenarios":"Running BigQueryIO read/write with --tempLocation set to a non-GCS URI (e.g. local path, s3://, or malformed gs:// URI) while using the default BigQueryServices (not injected test stubs).","commonSituations":"Forgetting --tempLocation and picking up a wrong default; pointing tempLocation at a local directory; typos like 'gs:/bucket' or 'file:///tmp'.","solutions":["Set --tempLocation to a valid GCS path, e.g. gs://my-bucket/temp","Verify the URI parses as a GcsPath (starts with gs:// and has a bucket)","If running on a runner that supplies tempLocation automatically, confirm it is a GCS path"],"exampleFix":"// before\n--tempLocation=/tmp/beam-temp\n// after\n--tempLocation=gs://my-bucket/beam-temp","handlingStrategy":"validation","validationCode":"// Before running\nString tempLocation = options.getTempLocation();\nif (tempLocation == null || !tempLocation.startsWith(\"gs://\")) {\n  throw new IllegalArgumentException(\"--tempLocation must be a gs:// path, got: \" + tempLocation);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --tempLocation=gs://bucket/path when using BigQueryIO","Validate the URI with GcsPath.fromUri() in a smoke test","Do not point tempLocation at local or non-GCS filesystems"],"tags":["bigquery","gcs","config","java"],"backgroundTag":"invalid-url-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}