Unable to publish comment with a warning about incorrect JSON because of rate limited #9

Open
opened 2025-03-08 18:31:38 +01:00 by Benjamin_Loison · 9 comments
Owner

See Benjamin-Loison/gitea/issues/46.

I doubt that Gitea default settings set such a quite aggressive rate limit.

+56

See [Benjamin-Loison/gitea/issues/46](https://github.com/Benjamin-Loison/gitea/issues/46). I doubt that Gitea default settings set such a quite aggressive rate limit. +56
Author
Owner

A workaround is to append to last issue comment.

A workaround is to append to last issue comment.
Author
Owner
{"errorMessage":"You've been rate limited","renderFormat":"text"}
{"redirect":"/Benjamin_Loison/Improve_websites_thanks_to_open_source/issues/1496"}

Screenshot from 2025-03-14 18-06-29.png

Network error SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 2 column 1 of the JSON data

```json {"errorMessage":"You've been rate limited","renderFormat":"text"} {"redirect":"/Benjamin_Loison/Improve_websites_thanks_to_open_source/issues/1496"} ``` ![Screenshot from 2025-03-14 18-06-29.png](/attachments/1aac4e44-6966-4dbf-84f7-b359a44d2779) > Network error SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 2 column 1 of the JSON data
Author
Owner
Related to [Benjamin-Loison/gitea/issues/211#issuecomment-3724849757](https://github.com/Benjamin-Loison/gitea/issues/211#issuecomment-3724849757).
Author
Owner
https://matrix.to/#/!ImcWflUWyvAekDFLHt:matrix.tu-berlin.de/$btcKyde_W_KQr5CNoRjzVsBX7qeyMUkXiU9SSNkg7EY also faces this issue.
Author
Owner

Screenshot From 2026-10-24 21-25-45.png

What about new issue comment?

![Screenshot From 2026-10-24 21-25-45.png](attachments/b4140a36-ea4f-4673-822e-0277101705ec) What about new issue comment?
Author
Owner

How much time to wait?

Relevant response headers are:

ratelimit: "baseline";r=1925;t=600
ratelimit-policy: "baseline";q=2000;w=600

are similar, but meaning is unclear.

There is no Mozilla explanation button.

Response is identical as above, hence does not help.

How much time to wait? Relevant response headers are: `ratelimit`: `"baseline";r=1925;t=600` `ratelimit-policy`: `"baseline";q=2000;w=600` are similar, but meaning is unclear. There is no Mozilla explanation button. Response is identical as above, hence does not help.
Author
Owner

DuckDuckGo search "ratelimit" HTTP header.

May help Benjamin_Loison/Improve_websites_thanks_to_open_source/issues/3842.

DuckDuckGo search `"ratelimit" HTTP header`. May help [Benjamin_Loison/Improve_websites_thanks_to_open_source/issues/3842](https://codeberg.org/Benjamin_Loison/Improve_websites_thanks_to_open_source/issues/3842).
Author
Owner
https://www.ietf.org/archive/id/draft-polli-ratelimit-headers-02.html relevantly mention `w`, but not `q`, `r` and `t`.
Author
Owner

Mistral: conv_01a1ac49476475fb92e43416dba60156

What HTTP response headers:

ratelimit: "baseline";r=1925;t=600
ratelimit-policy: "baseline";q=2000;w=600

mean?

Mistral GLM 5.3 Think and Search:

These are the RateLimit / RateLimit-Policy response headers defined by the IETF Internet-Draft "RateLimit header fields for HTTP" (draft-ietf-httpapi-ratelimit-headers, HTTPAPI working group). They let a server advertise its rate-limit policy and the client's current quota, so clients can throttle themselves and avoid getting hit with 429 Too Many Requests.

Decoding your example

ratelimit:        "baseline";r=1925;t=600
ratelimit-policy: "baseline";q=2000;w=600

The syntax is HTTP Structured Fields (RFC 8941) — a quoted string (the name of the quota/policy) followed by semicolon-separated parameters:

ratelimit-policy — the static policy (what you may do)

Token Meaning Value
"baseline" Name of the quota policy "baseline"
q Quota — max number of requests (quota units) per window 2000 requests
w Window — length of the time window in seconds 600 s = 10 minutes

→ "Under the 'baseline' policy you may make 2000 requests per 10-minute window."

ratelimit — the current state (what you have left)

Token Meaning Value
"baseline" Which policy this applies to (matches the policy name) "baseline"
r Remaining — quota units still available in the current window 1925 requests left
t Time to reset — seconds until the window resets and quota is reallocated 600 s

→ "You have 1925 of your 2000 requests remaining, and the window resets in 600 seconds."

In plain English

You're allowed 2000 requests per 10-minute window ("baseline" tier). Right now you have 1925 requests left, and the counter resets in 600 seconds.

Notes

  • Both headers are lists, so a server can advertise multiple named policies at once, e.g. ratelimit: "baseline";r=1925;t=600, "burst";r=10;t=1.
  • The quoted-string values ("baseline") are just how Structured Fields represent strings — the quotes are syntactic, not part of the name.
  • The spec is still an Internet-Draft (not yet an RFC), and earlier draft versions used a different design (RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset as three separate headers). The two-header version you're seeing is the current design.
  • A well-behaved client uses these to pace itself (back off when r gets low, wait t seconds when exhausted), and the draft also defines a https://iana.org/assignments/http-problem-types#rate-limit problem type for 429 responses.

understanding seems decent, but not what I face.

Mistral: `conv_01a1ac49476475fb92e43416dba60156` > What HTTP response headers: > > `ratelimit`: `"baseline";r=1925;t=600` > `ratelimit-policy`: `"baseline";q=2000;w=600` > > mean? <details> <summary>Mistral GLM 5.3 <i>Think</i> and <i>Search</i>:</summary> These are the **`RateLimit` / `RateLimit-Policy` response headers** defined by the IETF Internet-Draft [*"RateLimit header fields for HTTP"*](https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/) (draft-ietf-httpapi-ratelimit-headers, HTTPAPI working group). They let a server advertise its rate-limit policy and the client's current quota, so clients can throttle themselves and avoid getting hit with `429 Too Many Requests`. ## Decoding your example ``` ratelimit: "baseline";r=1925;t=600 ratelimit-policy: "baseline";q=2000;w=600 ``` The syntax is **HTTP Structured Fields** (RFC 8941) — a quoted string (the name of the quota/policy) followed by semicolon-separated parameters: ### `ratelimit-policy` — the static policy (what you *may* do) | Token | Meaning | Value | |---|---|---| | `"baseline"` | Name of the quota policy | "baseline" | | `q` | **Quota** — max number of requests (quota units) per window | **2000 requests** | | `w` | **Window** — length of the time window in seconds | **600 s = 10 minutes** | → *"Under the 'baseline' policy you may make 2000 requests per 10-minute window."* ### `ratelimit` — the current state (what you *have left*) | Token | Meaning | Value | |---|---|---| | `"baseline"` | Which policy this applies to (matches the policy name) | "baseline" | | `r` | **Remaining** — quota units still available in the current window | **1925 requests left** | | `t` | **Time to reset** — seconds until the window resets and quota is reallocated | **600 s** | → *"You have 1925 of your 2000 requests remaining, and the window resets in 600 seconds."* ## In plain English > You're allowed 2000 requests per 10-minute window ("baseline" tier). Right now you have **1925 requests left**, and the counter resets in **600 seconds**. ## Notes - Both headers are **lists**, so a server can advertise multiple named policies at once, e.g. `ratelimit: "baseline";r=1925;t=600, "burst";r=10;t=1`. - The quoted-string values (`"baseline"`) are just how Structured Fields represent strings — the quotes are syntactic, not part of the name. - The spec is still an **Internet-Draft** (not yet an RFC), and earlier draft versions used a different design (`RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` as three separate headers). The two-header version you're seeing is the current design. - A well-behaved client uses these to pace itself (back off when `r` gets low, wait `t` seconds when exhausted), and the draft also defines a `https://iana.org/assignments/http-problem-types#rate-limit` problem type for `429` responses. </details> understanding seems decent, but not what I face.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/codeberg#9