Title: Bigquery Python Library: `AppendRows` bidi-streaming RPC sends empty `x-goog-request-params` routing header, causing intermittent `InvalidArgument: Cannot route on empty project id ''`` · Issue #16650 · googleapis/google-cloud-python · GitHub
Open Graph Title: Bigquery Python Library: `AppendRows` bidi-streaming RPC sends empty `x-goog-request-params` routing header, causing intermittent `InvalidArgument: Cannot route on empty project id ''`` · Issue #16650 · googleapis/google-cloud-python
X Title: Bigquery Python Library: `AppendRows` bidi-streaming RPC sends empty `x-goog-request-params` routing header, causing intermittent `InvalidArgument: Cannot route on empty project id ''`` · Issue #16650 · googleapis/google-cloud-python
Description: Determine this is the right repository I determined this is the correct repository in which to report this bug. Summary of the issue Context Using BigQueryWriteClient.append_rows() to write data via the Storage Write API default stream (...
Open Graph Description: Determine this is the right repository I determined this is the correct repository in which to report this bug. Summary of the issue Context Using BigQueryWriteClient.append_rows() to write data vi...
X Description: Determine this is the right repository I determined this is the correct repository in which to report this bug. Summary of the issue Context Using BigQueryWriteClient.append_rows() to write data vi...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/16650
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bigquery Python Library: `AppendRows` bidi-streaming RPC sends empty `x-goog-request-params` routing header, causing intermittent `InvalidArgument: Cannot route on empty project id ''``","articleBody":"### Determine this is the right repository\n\n- [x] I determined this is the correct repository in which to report this bug.\n\n### Summary of the issue\n\n\n**Context**\n\nUsing `BigQueryWriteClient.append_rows()` to write data via the Storage Write API default stream (`_default`), with multiple sequential calls through the same client. This is in a multiprocessing setup where each worker creates its own `BigQueryWriteClient()` and makes many `append_rows` calls.\n\n**Expected Behavior:**\n\n`append_rows` should populate the `x-goog-request-params` gRPC routing header with the `write_stream` resource name (which contains the project ID), similar to how other methods in the same client do it:\n\n```python\n# create_write_stream — sets routing correctly\nmetadata = ... + (gapic_v1.routing_header.to_grpc_metadata(((\"parent\", request.parent),)),)\n```\n\n**Actual Behavior:**\n\n`append_rows` sends an empty routing header because it's a bidi-streaming RPC and the request iterator hasn't been consumed when metadata is set:\n\n```python\n# client.py, append_rows() — all versions 2.26.0 through 2.37.0\nmetadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata(()),)\n```\n\nThis produces `x-goog-request-params: ''`. The first several calls may succeed via the gateway's fallback routing, but after a gRPC reconnection (idle timeout, load balancing), the gateway cannot determine the target project and returns:\n\n```\ngoogle.api_core.exceptions.InvalidArgument: 400 Cannot route on empty project id ''\n```\n\n**Reproduction:**\n\n```python\nfrom google.cloud.bigquery_storage_v1 import BigQueryWriteClient\nfrom google.api_core.gapic_v1 import routing_header\nimport inspect\n\n# Verify empty routing in source\nsource = inspect.getsource(BigQueryWriteClient.append_rows)\nassert \"to_grpc_metadata(())\" in source\n\n# Verify it produces an empty header\nassert routing_header.to_grpc_metadata(()) == (\"x-goog-request-params\", \"\")\n```\n\n**Workaround:**\n\nPass routing metadata explicitly:\n\n```python\nmetadata = (routing_header.to_grpc_metadata(((\"write_stream\", stream_name),)),)\nresponse = client.append_rows(requests=iter([request]), metadata=metadata)\n```\n\n**Environment:**\n- `google-cloud-bigquery-storage`: 2.26.0 through 2.37.0 (all affected)\n- Python 3.9\n\n### API client name and version\n\n_No response_\n\n### Reproduction steps: code\n\nfile: main.py\n```python\n def reproduce():\n # complete code here\n```\n\n\u003cany additional py files>\n\n\n### Reproduction steps: supporting files\n\nfile: mydata.csv\n```\nalpha,1,3\nbeta,2,5\n```\n\n\u003cany additional supporting files>\n\n\n### Reproduction steps: actual results\n\nfile: output.txtmydata.csv\n```\nCalculated: foo\n```\n\n\n### Reproduction steps: expected results\n\nfile: output.txtmydata.csv\n```\nCalculated: bar\n```\n\n\n### OS & version + platform\n\n_No response_\n\n### Python environment\n\n_No response_\n\n### Python dependencies\n\n_No response_\n\n### Additional context\n\n_No response_","author":{"url":"https://github.com/erezinman","@type":"Person","name":"erezinman"},"datePublished":"2026-04-14T19:44:22Z","url":"https://github.com/googleapis/google-cloud-python/issues/16650"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a5e4293b-a3b5-ed5e-aa5f-2d8596504ade |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A5D6:D8CB1:9FFCB7:D9C214:6AFE7A39 |
| html-safe-nonce | 71bac2014a68119c24948129fc560b3eaa7b937bc3dcbeef8cf206f38d7c53c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUQ2OkQ4Q0IxOjlGRkNCNzpEOUMyMTQ6NkFGRTdBMzkiLCJ2aXNpdG9yX2lkIjoiMTg2NzUwMzk4MzEyODM3NzkxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6af544c3f3bb03631b17feaea0a2093ae03989b78edceda41a9ff033becd8f97 |
| hovercard-subject-tag | issue:4264357156 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/16650/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b3debccd8699f4ee2db2d032a0b6eb90ab5f20720864f7d461654841f690bb36/googleapis/google-cloud-python/issues/16650 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b3debccd8699f4ee2db2d032a0b6eb90ab5f20720864f7d461654841f690bb36/googleapis/google-cloud-python/issues/16650 |
| og:image:alt | Determine this is the right repository I determined this is the correct repository in which to report this bug. Summary of the issue Context Using BigQueryWriteClient.append_rows() to write data vi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | erezinman |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width