Typo: Duplicate header name in authentication error message
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- authentication
Research direction
Start in src/openai/_client.py at the sync client around line 664 and the async client around line 1428, then compare the authentication error messages. Correct the duplicated header name and remove the unnecessary embedded quotes as described, then reproduce the missing-credentials case to confirm the resulting message.
Written by the indexing model from the issue text.
Description
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:
"
AuthorizationorAuthorizationheaders 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
- 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"'
)
- 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)
- Dominant language
- Python
- Stars
- 31.7k
- Forks
- 5.8k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 106
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/openai-python
-
sdk-breaking-change v4
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
openai/openai-python#3837 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openai/openai-python#3556 · 3 comments ·
Maintainers usually reply within 1 day
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openai/openai-python#3294 · 3 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openai/openai-python#2927 · 7 comments ·
Maintainers usually reply within 1 day
-
bug openapi
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/openai-python#2502 · 7 comments ·
Maintainers usually reply within 1 day
All issues in openai/openai-python
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
kristofdegrave/homeassistant-smart-charging#1413 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
nasa/earthdata-varinfo#113 ·
-
curriculum documentation quality
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
githubnext/gh-aw-workshop#3849 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day