ValueError When Handling Retry-After Headers After 429 Too Many Requests Error

Open Beginner friendly
#230 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
php
Domain
api

Research direction

Start in vendor/microsoft/kiota-http-guzzle/src/Middleware/RetryHandler.php around line 298 and reproduce the 429 response from simultaneous OneDrive search requests. Verify handling of a Retry-After value such as "60,120" and confirm the request can retry or produce an appropriate HTTP exception instead of the parse error.

Written by the indexing model from the issue text.

Description

status:waiting-for-triage type:bug
Describe the bug

The issue arises after encountering a 429 Too Many Requests error, which likely returns an incorrect Retry-After header value like 60,120 (representing two retry times or a malformed retry interval). When the retry handler attempts to process this value, it throws an error because it cannot properly parse the value into an integer due to the comma.

This bug was also observed in the Python version of the SDK and has been resolved by splitting the value on the comma, and using only the first of the two resulting values.

Expected behavior
  • Server returns proper Retry After value
  • Client is able to properly parse value & retry request or if still gets 429, throw an appropriate HTTP exception.
How to reproduce
  • Trigger a 429 Too Many Requests error by sending multple simultaneous requests to onedrive search endpoint me/drive/root/search(q='t')
  • Observe that the Retry-After header contains the value "60,120".
  • The retry handler fails with the error Fatal error: Uncaught exception "RuntimeException" with message "Unable to parse Retry-After header value 60,120" File: /var/www/html/vendor/microsoft/kiota-http-guzzle/src/Middleware/RetryHandler.php on line 298
SDK Version

2.4.0

Latest version known to work for scenario above?

No response

Known Workarounds

None

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
Dominant language
PHP
Stars
16
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoftgraph/msgraph-sdk-php-core

All issues in microsoftgraph/msgraph-sdk-php-core

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.