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

Typo: Duplicate header name in authentication error message

Aperta Adatta ai principianti
#3,962 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia in src/openai/_client.py, nel client sincrono intorno alla riga 664 e nel client asincrono intorno alla riga 1428, quindi confronta i messaggi di errore di autenticazione. Correggi il nome dell’header duplicato e rimuovi le virgolette incorporate non necessarie come descritto, quindi riproduci il caso di credenziali mancanti per confermare il messaggio risultante.

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

Descrizione


name: Typo bug report
about: Typo in authentication error message (duplicate "Authorization")
title: 'Typo: Duplicate header name in authentication error message'
labels: bug, documentation
assignees: ''

Confirm this is an issue with the Python library and not an underlying OpenAI API
  • This is an issue with the Python library
Describe the bug

There is a copy-paste typo in the _validate_headers error message in both the sync and async clients. The message says:

"Authorization or Authorization headers to be explicitly omitted"

But it should mention both supported auth headers: Authorization (Bearer tokens) and api-key (API key auth).

Looking at the X.509 auth code in src/openai/auth/_x509.py:66, the SDK actually checks for api-key, x-api-key, and proxy-authorization headers as well.

Locations

File: src/openai/_client.py

  1. Sync client, line 664:
raise TypeError(
    '"Could not resolve authentication method. Expected either api_key or admin_api_key to be set. Or for one of the `Authorization` or `Authorization` headers to be explicitly omitted"'
)
  1. Async client, line 1428:
raise TypeError(
    '"Could not resolve authentication method. Expected either api_key or admin_api_key to be set. Or for one of the `Authorization` or `Authorization` headers to be explicitly omitted"'
)
Proposed fix

Change the error message to correctly list the auth headers:

raise TypeError(
    "Could not resolve authentication method. Expected either api_key or admin_api_key to be set. Or for one of the `Authorization` or `api-key` headers to be explicitly omitted"
)

(Also note the original message has extra leading/trailing double quotes inside the string which is also unnecessary.)

To Reproduce

Call any API method without setting credentials and without explicitly omitting auth headers.

Library version

v2.x latest (main branch)

Lingua principale
Python
Stelle
31.7k
Fork
5.8k
Merge medio
2g 10h
PR unite (30g)
98

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 openai/openai-python

Tutte le issue di openai/openai-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.