Skip to content

Fix: Replace head with jq limit() to prevent broken pipe error#252

Merged
chorrell merged 1 commit intomainfrom
fix/jq-broken-pipe
Feb 20, 2026
Merged

Fix: Replace head with jq limit() to prevent broken pipe error#252
chorrell merged 1 commit intomainfrom
fix/jq-broken-pipe

Conversation

@chorrell
Copy link
Owner

When running the 'Update Image' workflow, jq fails with 'jq: error: writing output failed: Broken pipe' because head closes the pipe after N lines.

This fix replaces the head command with jq's limit() function to avoid the broken pipe error. The limit function is called inside jq, so there is no external pipe that can be closed prematurely.

Changes:

  • Replace 'head -${LIMIT}' with 'limit($limit | tonumber; .[])'
  • Pass LIMIT as --arg to jq and use tonumber to convert
  • More efficient and robust

All 22 tests pass with this change.

- Use jq's limit() function instead of shell's head to avoid broken pipe errors
- Pass LIMIT as --arg to jq and convert with tonumber inside the limit() call
- Fixes 'jq: error: writing output failed: Broken pipe' errors in CI/CD
- More efficient: avoids creating pipe to head command
- All 22 tests pass
@chorrell chorrell merged commit 1141cca into main Feb 20, 2026
2 checks passed
@chorrell chorrell deleted the fix/jq-broken-pipe branch February 20, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant