all `client.webhooks` operations fail with API error occurred: Status 404

Aberta
#3,316 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@VISHNU0906 já está trabalhando nisso.

Desde 8/11/2026.

  • #3319 de @VISHNU0906 — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
54/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
api

Direção de pesquisa

Start by tracing how client.webhooks builds its request path and how the client selects the API version from HttpOptions; the issue identifies /v1/webhooks and /v1beta as the failing and working routes. Check the webhooks tests and add coverage showing that management calls use v1beta routing by default while other client routing remains unaffected. Done means the reported 404 is covered and webhook list and create calls use the deployed route.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

priority: p2 type: bug
Description

In the latest major version (v3.0.0+), all client.webhooks operations—including client.webhooks.list() and client.webhooks.create()—fail with a google.genai._gaos.errors.genaidefaulterror.GenAiDefaultError: API error occurred: Status 404.

This occurs because v3.0.0 changed the default developer API routing version to v1. However, the Gemini webhooks subsystem is currently only deployed on the v1beta path structure. Because the SDK makes calls directly to /v1/webhooks, Google's production servers reject the route with a standard 404 HTML document page. The SDK should explicitly default to v1beta routing internally for webhooks management.

Environment Details
  • SDK Package: google-genai (v3.0.0 and above)
  • Auth Layer: Google AI Studio developer API key (api_key="...")
Steps to Reproduce
from google import genai

# Standard initialization defaults to /v1/ routes in v3.0.0+
client = genai.Client(api_key="VALID_GEMINI_KEY")

# Triggers the 404 exception loop instantly
webhooks = client.webhooks.list()
Traceback Log
google.genai._gaos.errors.genaidefaulterror.GenAiDefaultError: API error occurred: Status 404 Content-Type text/html. Body: ""
...
google.genai._gaos.lib.compat_errors.NotFoundError: Error code: 404
Working Workarounds
Workaround 1: Explicitly pass HttpOptions to the Client (Recommended)

You can override the client's automated route configuration to force the endpoint path back to v1beta where the webhooks framework is live:

from google import genai
from google.genai.types import HttpOptions

client = genai.Client(
    api_key="YOUR_GEMINI_API_KEY",
    http_options=HttpOptions(api_version="v1beta")
)

# This succeeds perfectly
webhooks_list = client.webhooks.list()
Workaround 2: Environment Variable Override

Setting the framework version override globally in the active terminal environment shell also bypasses the 404 issue:

  • Windows Cmd: set GOOGLE_GENAI_API_VERSION=v1beta
  • PowerShell: $env:GOOGLE_GENAI_API_VERSION="v1beta"
  • Linux/macOS: export GOOGLE_GENAI_API_VERSION="v1beta"
Linguagem predominante
Python
Estrelas
4.1k
Forks
1.1k
Merge médio
1d 20h
PRs com merge (30d)
99

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de googleapis/python-genai

Todas as issues de googleapis/python-genai

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.