Repository navigation
Conversation
GET /api/v1/challenges?limit=2.5 passed 2.5 to D1 as the LIMIT, which SQLite refuses with "datatype mismatch", and the Worker threw. The limit is now rounded down after the existing clamp, so every value that worked before gives the same result.
owizdom
marked this pull request as ready for review
November 27, 2026 14:12
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
GET /api/v1/challenges?limit=2.5returns 500 on https://akashi.lucidcomputing.ai (Cloudflareerror code: 1101, an uncaught Worker exception), while?limit=2returns 200. The route clampslimitto 1..100 but keeps the fraction, and D1 refuses a fractionalLIMITwithD1_ERROR: datatype mismatch, which nothing catches. Any limit strictly between 1 and 100 with a fraction did the same.The limit is now rounded down after the clamp, so
2.5lists 2 challenges. Every value that worked before gives the same result, including0.5(1),100.5(100),1e3(100) andabc(20).Rounding down follows how this parameter already treats other values: it clamps or defaults them rather than refusing them. If you would rather answer 400 for a non-integer limit, I can change it. No CHANGELOG line, since earlier
api/changes have not added one.Verification
npm cithennpm run checkinapi/on Node 24.22.3, as inapi.yml, from a fresh clone of this branch: types pass and 11 tests pass. Withsrc/index.tsfrommain, the new test fails with the D1 error. Underwrangler dev,?limit=2.5and?limit=1.5answered 500 oneccb15eand 200 here.