Skip to content

Error: HTTP 502 Bad Gateway. #10

@rempsyc

Description

@rempsyc

Sometimes, using "gemini-3-flash-preview", I get the error HTTP 502 Bad Gateway (today it is at every try, it seems). It seems to work on Portkey, so I wonder if it has to do with the NYU gateway again.

> rlang::last_trace(drop = FALSE)
<error/httr2_http_502>
Error in `req_perform()`:
! HTTP 502 Bad Gateway.
---
Backtrace:
     ▆
  1. └─base::lapply(...)
  2.   └─global FUN(X[[i]], ...)
  3.     └─nalanda::run_ai_on_chapters(...)
  4.       └─nalanda:::run_simulation_pipeline(...) at nalanda/R/run_ai_on_chapters.R:119:3
  5.         └─nalanda (local) executor(...) at nalanda/R/run_simulation_pipeline.R:101:5
  6.           └─chat$chat_structured(full_post_prompt, type = type_post) at nalanda/R/run_ai_on_chapters.R:213:9
  7.             └─coro::collect(...)
  8.               └─coro:::reduce_steps(x, steps, along_builder(list()))
  9.                 └─coro:::reduce(x, reducer, .init = identity)
 10.                   └─coro:::reduce_impl(.x, .f, ..., .init = .init)
 11.                     └─coro:::iter_reduce_impl(.x, .f, ..., .left = .left)
 12.                       ├─coro::is_exhausted(new <- .x())
 13.                       └─coro (local) .x()
 14.                         └─base::evalq(...)
 15.                           └─base::evalq(...)
 16.                             ├─base::evalq(...)
 17.                             │ └─base::evalq(...)
 18.                             │   └─coro (local) user(...)
 19.                             │     ├─.last_value <<- eval_bare(substitute(expr), user_env)
 20.                             │     │ └─rlang::env_poke(env, lhs, value, inherit = TRUE, create = FALSE)
 21.                             │     └─rlang::eval_bare(substitute(expr), user_env)
 22.                             └─ellmer:::chat_perform(...)
 23.                               └─httr2::req_perform(req)
 24.                                 └─httr2:::handle_resp(req, resp, error_call = error_call)
 25.                                   └─httr2:::resp_failure_cnd(req, resp, error_call = error_call)
 26.                                     ├─rlang::catch_cnd(...)
 27.                                     │ ├─rlang::eval_bare(...)
 28.                                     │ ├─base::tryCatch(...)
 29.                                     │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 30.                                     │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 31.                                     │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 32.                                     │ └─base::force(expr)
 33.                                     └─rlang::abort(...)

I am also struggling a bit to understand the portkey traces. On the one hand, the call seems successful, in the sense that the first chat turn is showing. However, there are two chat turns to my simulations. The book chapter is only provided on the second turn. I think Portkey shows each separate turns with separate turn IDs?

So for instance, here, Portkey shows only the first turn successfully, and the second turn never appears, as if it never made it to portkey. Is this possible? In this case, what use is there in providing the trace? Trace ID is: fe401940-474f-4b3c-aa0b-418b09a29f4a and the status code is 200. Can share the whole thing if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions