Skip to content

[Bug]: PHP Fatal error: Uncaught TypeError #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
smazur opened this issue Apr 8, 2025 · 5 comments
Open

[Bug]: PHP Fatal error: Uncaught TypeError #549

smazur opened this issue Apr 8, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@smazur
Copy link

smazur commented Apr 8, 2025

Description

PHP Fatal error: Uncaught TypeError: OpenAI\Responses\Threads\Messages\ThreadMessageResponse::from(): Argument #1 ($attributes) must be of type array, string given, called in .../vendor/openai-php/client/src/Resources/ThreadsMessages.php on line 32

Steps To Reproduce

This error happens irregularly during following call chain:

$client->threads()->messages()->create( $thread_id, $message );

OpenAI PHP Client Version

v0.10.3

PHP Version

8.2.16

Notes

After error_log debugging I found that API replied with 'Bad Gateway' response and 'Content-Type: text/plain`.

@smazur smazur added the bug Something isn't working label Apr 8, 2025
@iBotPeaches
Copy link
Collaborator

Yeah generally at the moment if the response isn't JSON - the handling isn't the best. This has manifested differently depending on the call. Some others related:

@bytestream
Copy link

Also #478

@datawench
Copy link

In my case this exact issue occurs when VectorStoresFiles::create() is returning "error code: 502" which is then passed as the argument to VectorStoreFileResponse::from(). I'm trying to try/catch these errors by hacking these methods, but it's not quite working yet, and thus breaking processing.

@iBotPeaches
Copy link
Collaborator

We have a fix in progress to rework a bit of the exception handling for that use-case. Trying to gather more samples in the field of the odd OpenAI issues to confirm: #553

@yhael-aloware
Copy link

Thanks! This has been bugging us for a few months, and even more in recent weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants