[spanner] `run_in_transaction` raises uncaught `IndexError` when `Aborted.errors` is empty
Mantenedores costumam responder em até 1 dia
Avaliação
Esta issue ainda não foi avaliada.
Descrição
Determine this is the right repository
- I determined this is the correct repository in which to report this bug.
Summary of the issue
When google.api_core.exceptions.Aborted is raised inside run_in_transaction with an empty errors attribute (e.g., manually instantiated Aborted("...")), run_in_transaction fails with an uncaught IndexError: list index out of range because it directly accesses exc.errors[0] without checking if exc.errors is empty.
While instantiating Aborted manually without errors may not be the standard path, the SDK should defensively handle empty errors (e.g., falling back to default_retry_delay) instead of crashing with an IndexError.
API client name and version
google-cloud-spanner==3.69.0
Reproduction steps: code
from google.api_core.exceptions import Aborted
from google.cloud import spanner
spanner_client = spanner.Client()
instance = spanner_client.instance("your-instance-id")
database = instance.database("your-database-id")
def callback(transaction):
# Raising Aborted without providing the errors payload
raise Aborted("VersionMismatch: CAS failed")
database.run_in_transaction(callback)
Reproduction steps: supporting files
No response
Reproduction steps: actual results
IndexError: list index out of range
(Occurs inside delay_seconds = _get_retry_delay(exc.errors[0], ...))
Reproduction steps: expected results
The SDK handles empty exc.errors gracefully (e.g., uses default_retry_delay) and executes the transaction retry loop as intended without raising an IndexError.
OS & version + platform
Windows 11
Python environment
Python 3.14.6
Python dependencies
Package Version
certifi 2026.7.22
cffi 2.1.0
charset-normalizer 3.4.9
cryptography 49.0.0
google-api-core 2.33.0
google-auth 2.56.2
google-cloud-core 2.6.0
google-cloud-monitoring 2.31.0
google-cloud-spanner 3.69.0
google-cloud-storage 3.13.0
google-crc32c 1.8.0
google-resumable-media 2.10.0
googleapis-common-protos 1.75.0
grpc-google-iam-v1 0.14.4
grpc-interceptor 0.15.4
grpcio 1.82.1
grpcio-status 1.82.1
idna 3.18
mmh3 5.2.1
opentelemetry-api 1.44.0
opentelemetry-resourcedetector-gcp 1.12.0a0
opentelemetry-sdk 1.44.0
opentelemetry-semantic-conventions 0.65b0
pip 26.1.2
proto-plus 1.28.2
protobuf 7.35.1
pyasn1 0.6.4
pyasn1_modules 0.4.2
pycparser 3.0
requests 2.34.2
sqlparse 0.5.5
typing_extensions 4.16.0
urllib3 2.7.0
Additional context
Defensive check like if exc.errors: before accessing exc.errors[0] would prevent IndexError and make error handling in run_in_transaction much more robust.
- Linguagem predominante
- Python
- Estrelas
- 5.4k
- Forks
- 1.8k
- Merge médio
- 2d 18h
- PRs com merge (30d)
- 146
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de googleapis/google-cloud-python
-
api: spanner type: feature request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
googleapis/google-cloud-python#18584 ·
Mantenedores costumam responder em até 1 dia
-
ci: remove UV_PRERELEASE workaround once Python 3.15 is officially releasedTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
googleapis/google-cloud-python#18532 ·
Mantenedores costumam responder em até 1 dia
-
auth: call_client_cert_callback() discards passphrase for encrypted keysTalvez já em andamento @kwy404 assumiu há 8 dias. Aberta
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 92/100
googleapis/google-cloud-python#18467 ·
Mantenedores costumam responder em até 1 dia
-
auth: `impersonated_credentials` loses `subject` on copy, so `with_scopes()` and `with_quota_project()` turn off domain wide delegationTalvez já em andamento @Om-singhaI assumiu há 20 dias. Abertaauth priority: p2 type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
googleapis/google-cloud-python#18428 ·
Mantenedores costumam responder em até 1 dia
-
priority: p2 type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
googleapis/google-cloud-python#18375 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de googleapis/google-cloud-python
Issues semelhantes
-
request-theme
Dificuldade 2/5 Menos de uma hora Facilidade para iniciantes 70/100
LizardByte/ThemerrDB#8877 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area/install-update comp/gateway P0 sweeper:risk-compatibility type/bug
Dificuldade 2/5 Menos de uma hora Facilidade para iniciantes 72/100
NousResearch/hermes-agent#135997 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
deepset-ai/haystack#13199 ·
Mantenedores costumam responder em até 1 dia
-
[BUG] JSONLoader rejects valid UTF-8 BOM filesTalvez já em andamento @zouyonghe assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
anthropics/knowledge-work-plugins#1298 ·
Mantenedores costumam responder em até 1 dia