Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Execution.create() fails with 503 due to credentials annotation typo

Aperta Adatta ai principianti
#6,610 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@javabrett ci sta già lavorando.

Dal 19/4/2026.

  • #6611 di @javabrett — aperta
  • #6983 di @PSR94 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
google-cloud, python

Direzione di ricerca

Inizia in google/cloud/aiplatform/metadata/execution.py, nelle definizioni di create() e _create(), quindi confronta i relativi parametri credentials e il flusso di inizializzazione con artifact.py e context.py. Esegui la riproduzione standalone fornita di Execution.create(); il lavoro è completato quando l’annotazione e la configurazione predefinita del metadata store corrispondono al comportamento richiesto dall’issue e la chiamata non fallisce più con il 503 segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

api: vertex-ai

Bug

google.cloud.aiplatform.metadata.execution.Execution.create() fails with a 503 error when called without explicitly passing credentials=:

503 Getting metadata from plugin failed with error: before_request
Root cause

Two issues in google/cloud/aiplatform/metadata/execution.py:

1. credentials parameter annotation typo (high severity)

Both create() and _create() use = instead of : for the credentials type annotation:

# Current (broken) -- execution.py lines 103, 181:
credentials=Optional[auth_credentials.Credentials],

# Should be (matches artifact.py, context.py):
credentials: Optional[auth_credentials.Credentials] = None,

Because = is used instead of :, the default value is the typing.Optional[google.auth.credentials.Credentials] type object itself (a _UnionGenericAlias), not None. This non-None type object is passed down to the gRPC auth stack, which attempts to call .before_request() on it, producing the 503.

Introduced in PR #1410 (June 2022). artifact.py and context.py both have the correct : ... = None syntax.

2. Missing ensure_default_metadata_store_exists() call (lower severity)

Artifact.create() calls metadata_store._MetadataStore.ensure_default_metadata_store_exists() before delegating to _create(). Execution.create() skips this call entirely. This means standalone Execution.create() will also fail if the default metadata store hasn't been implicitly created by a prior Artifact.create() or aiplatform.init(experiment=...) call. Context.create() has the same gap but is not addressed here.

Reproduction
from google.cloud import aiplatform
from google.cloud.aiplatform.metadata import execution as metadata_execution
from google.cloud.aiplatform.compat.types import execution as gca_execution

aiplatform.init(project="my-project", location="us-central1")

# This fails with 503:
exec_obj = metadata_execution.Execution.create(
    schema_title="system.CustomJob",
    resource_id="test-execution",
    display_name="test",
    state=gca_execution.Execution.State.COMPLETE,
    metadata={"component_type": "custom_job"},
)
Workaround

Call ensure_default_metadata_store_exists() manually, which also initializes credentials properly:

from google.cloud.aiplatform.metadata import metadata_store
metadata_store._MetadataStore.ensure_default_metadata_store_exists(
    project="my-project", location="us-central1",
)
# Now Execution.create() works
Fix

Two changes to execution.py:

  1. Fix credentials=Optional[auth_credentials.Credentials] to credentials: Optional[auth_credentials.Credentials] = None on both create() and _create()
  2. Add the ensure_default_metadata_store_exists() call in create() (matching Artifact.create())
Environment
  • google-cloud-aiplatform 1.140.0
  • Python 3.13.2
  • macOS / Vertex AI training containers (both affected)
Lingua principale
Python
Stelle
908
Fork
468
Merge medio
2g 4h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di googleapis/python-aiplatform

Tutte le issue di googleapis/python-aiplatform

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.