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
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.

1 participant