[wp-trac] [WordPress Trac] #65094: AI: Prompt construction fails with fatal error when wp_ai_client_default_request_timeout filter returns negative number
WordPress Trac
noreply at wordpress.org
Sun Apr 19 18:49:10 UTC 2026
#65094: AI: Prompt construction fails with fatal error when
wp_ai_client_default_request_timeout filter returns negative number
--------------------------------------+--------------------------
Reporter: westonruter | Owner: westonruter
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 7.0
Component: AI | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+--------------------------
Comment (by khushdoms):
Tested the patch locally in a WordPress 7.0 development environment.
**Testing setup:**
* Theme: Twenty Twenty-Five (v1.4)
* Added the following filter and test trigger in `functions.php`:
```
add_filter(
'wp_ai_client_default_request_timeout',
function () {
return -1;
}
);
add_action('init', function () {
if ( function_exists('wp_ai_client_prompt') ) {
wp_ai_client_prompt("Test prompt");
}
});
```
**Before applying the patch:**
* Encountered a fatal error:
`InvalidArgumentException: Request option "timeout" must be greater than
or equal to 0`
screenshot : https://prnt.sc/yC5V3AwWnwyF
**After applying the patch:**
* No fatal error occurs ✅
* Invalid timeout value is handled gracefully
* Application continues to run normally
The patch successfully prevents the fatal error and aligns with expected
WordPress error-handling practices.
Patch works as expected 👍
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65094#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list