Skip to content

RetryHandler#retryRequest might fail with IllegalArgumentException: timeout value is negative #2038

Closed

Description

When using the Microsoft Graph API which then calls com.microsoft.kiota.http.middleware.RetryHandler.retryRequest (see stack trace below), it seems to trigger retryRequest with a negative retryInterval value. It seems that getRetryAfter is returning a negative value at https://github.com/microsoft/kiota-java/blob/main/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/RetryHandler.java#L112.

Please see stack trace:

java.lang.IllegalArgumentException: timeout value is negative
        at java.lang.Thread.sleep(Thread.java:500)
        at com.microsoft.kiota.http.middleware.RetryHandler.retryRequest(RetryHandler.java:115)
        at com.microsoft.kiota.http.middleware.RetryHandler.intercept(RetryHandler.java:252)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.microsoft.kiota.http.middleware.RedirectHandler.intercept(RedirectHandler.java:158)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.microsoft.kiota.http.middleware.HeadersInspectionHandler.intercept(HeadersInspectionHandler.java:70)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.microsoft.kiota.http.middleware.UrlReplaceHandler.intercept(UrlReplaceHandler.java:52)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.microsoft.kiota.http.middleware.ParametersNameDecodingHandler.intercept(ParametersNameDecodingHandler.java:79)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.microsoft.kiota.http.middleware.UserAgentHandler.intercept(UserAgentHandler.java:84)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler.intercept(GraphTelemetryHandler.java:64)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.microsoft.kiota.http.middleware.UrlReplaceHandler.intercept(UrlReplaceHandler.java:72)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
        at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
        at com.microsoft.kiota.http.OkHttpRequestAdapter.getHttpResponseMessage(OkHttpRequestAdapter.java:749)
        at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:302)

Activity

  1. moved this to Needs Triage 🔍 in Kiotaon Oct 6, 2025
  2. moved this from Needs Triage 🔍 to In Review 💭 in Kiotaon Nov 14, 2025
  3. baywet commented on Nov 14, 2025

    @baywet
    Member

    Hi Bibek Pandit (@bpandit-everlaw)
    Thank you for using kiota and for reaching out.

    I put together PR #2051 to address this issue.

    Let me know if you have any additional comments or questions.

  4. moved this from In Review 💭 to Done ✔️ in Kiotaon Nov 14, 2025
  5. bpandit-everlaw commented on Dec 12, 2025

    @bpandit-everlaw
    Author

    Thank you for resolving this issue Vincent Biret (@baywet) !

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status
    Done ✔️

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions