Skip to content

fix: add missing f-string prefix in async_to_httpx_files error message#3039

Open
Quratulain-bilal wants to merge 1 commit intoopenai:mainfrom
Quratulain-bilal:fix/async-file-type-error-fstring
Open

fix: add missing f-string prefix in async_to_httpx_files error message#3039
Quratulain-bilal wants to merge 1 commit intoopenai:mainfrom
Quratulain-bilal:fix/async-file-type-error-fstring

Conversation

@Quratulain-bilal
Copy link
Copy Markdown

Summary

  • Fixed a missing f prefix on the f-string in async_to_httpx_files() (src/openai/_files.py,
    line 100)
  • The sync version to_httpx_files() (line 58) correctly uses f"Unexpected file type input {type(files)}...", but the async counterpart was missing the f prefix
  • This caused the error message to display the literal string {type(files)} instead of the actual
    type

Bug Details

Before (broken):

raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence")
# Output: "Unexpected file type input {type(files)}, expected mapping or sequence"

After (fixed):
raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence")
# Output: "Unexpected file type input <class 'int'>, expected mapping or sequence"

The TypeError in `async_to_httpx_files` was missing the `f` prefix,
causing the error message to display the literal string
`{type(files)}` instead of the actual type. The sync version
`to_httpx_files` (line 58) correctly uses an f-string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Quratulain-bilal Quratulain-bilal requested a review from a team as a code owner March 30, 2026 00:52
@Quratulain-bilal
Copy link
Copy Markdown
Author

@openai/sdks-team Hi team, just checking if anyone has bandwidth to review this f-string fix? It's a small but important fix for error messages in the async function. Thanks!

Copy link
Copy Markdown

@LVT-ENG LVT-ENG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@Quratulain-bilal
Copy link
Copy Markdown
Author

Hi @openai/sdks-team 👋

Just a gentle follow-up on this PR. This is a small fix for an incorrect error message in the async version of async_to_httpx_files().

Would really appreciate a quick review when you have time. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants