fix: forge_api_paginate crashes on invalid JSON response #194
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
lib/env.sh forge_api_paginate (lines 228-236) calls jq length on the API response without checking if it is valid JSON. When Forgejo returns an HTML error page or truncated response, jq outputs nothing, and the integer comparison fails:
This floods cron.log with hundreds of warnings per poll cycle.
Root cause
Line 230 assigns count from jq, but if the response is not valid JSON, jq outputs empty string. Lines 231 and 233 then try to compare empty string as integer.
Proposed solution
Default count to 0 when jq fails:
Affected files
Acceptance criteria
Blocked — issue #194
no_push2026-04-04T21:19:04ZDiagnostic output
Blocked — issue #194
no_push2026-04-05T05:59:04ZDiagnostic output