forge label create exits 22 without diagnostics #100

Open
opened 2026-07-13 18:59:11 +01:00 by vnprc-agent · 0 comments
Contributor

User story: So that I can fix label setup failures without guessing, forge label create should report useful API or validation diagnostics whenever label creation is rejected.

Part of the "Forge / workspace CLI tooling" arc.


Bug

forge label create can fail with exit code 22 and print no error message, leaving the operator with no actionable cause.

Observed while trying to create a priority label on a repository with no existing labels:

forge -R <owner>/<repo> label create P0 -c '#FF0000' -d 'Maximum priority' -f

Result:

  • exit code: 22
  • stdout: empty
  • stderr: empty
  • label was not created

A prior variant without the leading # in the color also failed silently:

forge -R <owner>/<repo> label create P0 -c FF0000 -d 'Maximum priority' -f

Authentication was valid at the time, and forge label list still reported no labels afterward.

Expected behavior

If the Forgejo API rejects label creation, forge should print the HTTP status and response body, or a concise decoded error message. If the failure is client-side argument validation, it should report the invalid field.

At minimum, a failing forge label create should not exit nonzero with no diagnostics.

Acceptance criteria

  • Reproduce or add fixture coverage for a label-create API failure.
  • Ensure non-2xx responses from label create surface useful diagnostics.
  • Verify both accepted color formats, or document/enforce the supported format before making the API call.
  • forge label create ... failures include enough context to distinguish auth/permission, validation, route, and server errors.
**User story:** So that I can fix label setup failures without guessing, `forge label create` should report useful API or validation diagnostics whenever label creation is rejected. _Part of the "Forge / workspace CLI tooling" arc._ --- ## Bug `forge label create` can fail with exit code 22 and print no error message, leaving the operator with no actionable cause. Observed while trying to create a priority label on a repository with no existing labels: ```sh forge -R <owner>/<repo> label create P0 -c '#FF0000' -d 'Maximum priority' -f ``` Result: - exit code: `22` - stdout: empty - stderr: empty - label was not created A prior variant without the leading `#` in the color also failed silently: ```sh forge -R <owner>/<repo> label create P0 -c FF0000 -d 'Maximum priority' -f ``` Authentication was valid at the time, and `forge label list` still reported no labels afterward. ## Expected behavior If the Forgejo API rejects label creation, `forge` should print the HTTP status and response body, or a concise decoded error message. If the failure is client-side argument validation, it should report the invalid field. At minimum, a failing `forge label create` should not exit nonzero with no diagnostics. ## Acceptance criteria - Reproduce or add fixture coverage for a label-create API failure. - Ensure non-2xx responses from label create surface useful diagnostics. - Verify both accepted color formats, or document/enforce the supported format before making the API call. - `forge label create ...` failures include enough context to distinguish auth/permission, validation, route, and server errors.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
allod/tools#100
No description provided.