GeezerVison is showing github.com — api-core 2.35.0 breaks Firestore "(default)" database id — every call fails with "400 Invalid database id %28default%29" · Issue #18207 · googleapis/google-cloud-python
api-core 2.35.0 breaks Firestore "(default)" database id — every call fails with "400 Invalid database id %28default%29" #18207DescriptionPackage: google-api-core 2.35.0 (affects google-cloud-firestore; likely any client passing resource ids containing RFC 3986 reserved characters)
Environment
- Python 3.13 (also reproduced on the
python:3.13-slim container image)
- google-cloud-firestore 2.28.1 and 2.29.0 (both affected)
- google-api-core 2.35.0 (released 2026-08-24 ~21:55 UTC)
- Transport: gRPC (the default; the error surfaces via
google.api_core.grpc_helpers.error_remapped_callable)
Steps to reproduce
from google.cloud import firestore
db = firestore.Client(project="<any-project>", database="(default)")
db.collection("any_collection").document("any_id").get()
Actual behavior
Every RPC fails immediately:
google.api_core.exceptions.InvalidArgument: 400 Invalid database id %28default%29
Note the server echoes the percent-encoded database id — the client is sending %28default%29 where the backend expects the literal (default).
Expected behavior
The default-database id (default) reaches the backend unencoded, as it did in every release through 2.34.0.
Bisection (only google-api-core varied; same code and credentials throughout)
| google-api-core |
google-cloud-firestore |
Result |
| 2.30.3 |
2.27.0 |
✅ works |
| 2.34.0 |
2.29.0 |
✅ works |
| 2.35.0 |
2.28.1 |
❌ 400 Invalid database id %28default%29 |
| 2.35.0 |
2.29.0 |
❌ same error |
The regression is specific to ids with reserved characters
On 2.35.0, a database id without special characters still reaches the backend intact — pointing the client at a non-existent named database returns a clean 404 The database no-such-db does not exist for project ..., with the id echoed verbatim and un-encoded. Only the parenthesized (default) id gets corrupted.
Suspected change
The 2.35.0 changelog entry "fix(api_core): improve rest path validation" (#17753) is the prime suspect given the bisection window (2.34.0 → 2.35.0). Parentheses are outside the RFC 3986 unreserved set, so a stricter encoding pass "correctly" percent-encodes them — but the Firestore backend validates the database id literally and rejects the encoded form. Since the failure occurs over gRPC, the encoding appears to be applied to the request path / routing metadata shared by both transports, not just REST URLs.
Impact
Any workload using the default Firestore database (i.e. most Firestore users) that resolves dependencies without an upper bound on google-api-core loses all Firestore access the first time it rebuilds/redeploys. We were hit in a deployed environment within minutes of the release. Current mitigation: pin google-api-core<2.35.0. Reacted by Keisuke Oohashi, welson-squint, Chris Winters, James Zatsiorsky, Tash, Nick Graef, elinojrasmolo, Hemanth G, stijndecubber, ans and 1 more Activitywstock commented on Aug 25, 2026 Confirming from a second production hit (Python 3.12, python:3.12-slim, google-cloud-firestore 2.28.0, gRPC). An unchanged tree rebuilt ~24h after the release resolved 2.35.0 and every Firestore RPC failed with 400 Invalid database id %28default%29 until traffic was rolled back to the previous image.
The exact function is google.api_core.path_template.expand, which in 2.35.0 passes every substituted value through urllib.parse.quote(val, safe="/") (path_template.py ~L126 and ~L136 in the wheel). No client or network needed to reproduce:
from google.api_core import path_template, version
print(version.__version__)
print(path_template.expand("projects/{project}/databases/{database}",
project="demo", database="(default)"))
# 2.34.0 -> projects/demo/databases/(default)
# 2.35.0 -> projects/demo/databases/%28default%29
Firestore builds its database resource name through expand() with the literal id, which is why gRPC is affected and not only REST. Pinning google-api-core==2.34.0 restores service. Given most Firestore users are on (default), yanking 2.35.0 until the client side is aligned seems warranted. elinojrasmolo commented on Aug 25, 2026 Had this issue as well on our end. Just this morning after deploying a cloud function gen1.
For the mean time, we pin google-api-core==2.34.0. hemanthg4 commented on Aug 25, 2026 Another production confirmation (Python 3.12, python:3.12.4-slim-bookworm, firebase-admin → google-cloud-firestore, gRPC): first failing request 11 minutes after a routine image rebuild picked up 2.35.0. Pinning google-api-core==2.34.0 resolved it.
To pin down where the encoded id enters the request (it's not the routing metadata): google/cloud/firestore_v1/base_client.py builds the client's database resource name through the affected function and caches it —
# base_client.py :: BaseClient._database_string
db_str = google.api_core.path_template.expand(
"projects/{project}/databases/{database}",
project=self.project, database=self._database,
)
self._database_string_internal = db_str
That cached string becomes the database field of every RPC (Commit, BatchGetDocuments, RunQuery, …) and the prefix of every document name (base_path = self._database_string + "/documents/"). So with 2.35.0 the percent-encoded id is baked into the request proto itself, which is why the failure is transport-independent and hits reads and writes alike.
Diffing the 2.34.0 → 2.35.0 wheels, the only functional change in path_template.py is in _expand_variable_match: alongside the new dot-segment traversal validation, both the named and positional branches now return urllib.parse.quote(val, safe="/"). The validation itself looks fine and separable — it's only the quote() that changes the meaning of previously valid resource names. Possible fixes: return val unquoted (keep the validation), or extend the safe set to RFC 3986 sub-delims (parens are legal in path segments), or leave expand() alone and quote only at the REST URL layer.
Stopgap for anyone who can't rebuild with the pin immediately: the value is lazily cached, so pre-seeding it right after client creation bypasses expand() entirely:
client._database_string_internal = f"projects/{client.project}/databases/(default)"
Given (default) is what virtually every Firestore user is on, +1 to yanking 2.35.0 until this is patched. parthea commented on Aug 25, 2026 Hi @robin-jerome,
Thanks for reporting this issue. I've yanked google-api-core==2.35.0. Please follow the progress for the fix in #18215
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|