# Changing a ticket

`tkt ticket new "<title>" -g payments --description "<what>" --details "<what and why>" --ac "<criterion>"` creates (the first `-g` is the primary group and the id prefix), `tkt ticket update` is a merge-patch, `tkt ticket move` changes the primary group (a new id, every reference rewritten), `tkt ticket delete` deletes.

- **Content:** every new ticket needs a filled body `## Description` (`--details` or `--body`), a `feature` or `bug` also a filled acceptance criterion (`--ac`, repeatable); else `ERR_TICKET_CONTENT_MISSING`. An old incomplete ticket stays editable; only an update that empties `## Description` or removes the last criterion is refused (`ERR_TICKET_CONTENT_REMOVED`).
- **Status:** allowed transitions only (`ERR_STATUS_TRANSITION`); `in_progress` needs an effective `repoAnchor.repo` (`ERR_REPO_ANCHOR_MISSING`). Defer: `--status deferred --reason "<why>"` (the bundle has `block_reason: "deferred"`, `TICKET_DEFERRED`); cancel with a reason: `--status canceled --reason "<why>"`; resume with `--status backlog|todo`.
- **Lists:** `--add-label`, `--add-blocked-by PAY-002,PAY-003`, `--add-relates-to`, `--add-group` and their `--remove-…` pairs; `--blocked-by` / `--relates-to` replace the list; a missing target: `ERR_REL_DANGLING`.

## Details

- **Description:** every new ticket, group, decision, milestone, doc and gotcha needs `--description` (`description` over REST and in a plan), else `ERR_SCHEMA_MISSING_FIELD`. An old one without it stays editable and `tkt doctor` reports it (`MISSING_DESCRIPTION`); `--description` on `update` / `edit` sets it, `''` clears it.
- `tkt doctor` lists the old incomplete tickets (`EMPTY_DESCRIPTION`, `MISSING_ACCEPTANCE_CRITERIA`, with the command that fills them). The same rule holds over REST (`body`), in `tkt ticket import` and in the writes of `tkt plan`; a feedback report needs its own template.
- `ticket new` without `--body`: the type's template, which `--details` / `--ac` write into; without `--status`: `backlog`; `--label` sets labels. `blocked` is a mark, not a status: on an open ticket, an open `blockedBy` ticket sets it (`in_progress · blocked by PAY-010`, `tkt ticket list --blocked`); a `canceled` blocker gives `BLOCKER_CANCELED`; `tkt doctor` names a stored `blocked`. A block outside the store: `deferred` with `--reason`. `--reason` (only with a move to `deferred` / `canceled`, else `ERR_DEFER_REASON_INVALID`) goes to the `statusReason` field and, dated, to `## Notes`; the list, `--brief` and the bundle header show it, the next status change clears it (the note stays).
- **Successor:** `--superseded-by PAY-040` records the ticket that replaces this one (`relationships.supersededBy`): on an open ticket only with `--status canceled`, on a `done` or `canceled` ticket without a status change (else `ERR_SUPERSEDED_BY_INVALID`; a missing target `ERR_REL_DANGLING`, a loop `ERR_REL_CYCLE`). `--brief` and the bundle header show `continue at PAY-040`, the successor shows `supersedes`; `""` clears it, and so does reopening. A ticket that points at it (`blockedBy`, `relatesTo`, `parent`) gets `SUPERSEDED_TICKET`; for `blockedBy` the suggestion is to repoint it, the user's call.
- Transitions: backlog → todo, canceled, deferred; todo → in_progress, backlog, canceled, deferred; in_progress → in_review, todo, canceled; in_review → done, in_progress; done → in_progress; canceled → backlog; deferred → backlog, todo, canceled. `ticket new --status` is not checked. A feedback intake report (a `from:` label) may also go `todo` → `done`.
- **No-op write:** when the result equals what is stored (adding a link that is there, removing one that is not, the same field, `ref add` with the same fields, `section set` with the same text, `ac check` of a checked item), nothing is written, `updatedAt` stays, line 1 is `No change: …`, exit 0. `--json` has `changed: true|false` (on `update` also `changes`, the fields that changed; on `ac check|uncheck` `false` or the numbers it flipped).
- No flag for `repoAnchor`: edit the file; refs: [Refs and anchors](/en/docs/concepts/refs.md#context-refs).

- Lists (`tkt ticket update`): `--remove-label`, `--remove-blocked-by`, `--remove-relates-to`, `--remove-group`, `--parent` / `--no-parent`; `--blocked-by ""` clears it; a missing target writes nothing, over REST too. Every update reports on stderr what it removed (a target not in the list: unchanged; a `relatesTo` the other ticket records: adding it writes nothing, removing it prints the `tkt ticket update` that removes it there). The primary group cannot be removed (`ERR_GROUP_PRIMARY_LOCKED`): move instead.
- Move: `tkt ticket move PAY-001 -g billing --dry-run`, then `--yes`; a new id (`BILL-…`, the ULID stays), all or nothing; `## Notes` gets a line; doc and gotcha mentions are not rewritten; `--json` needs `--yes` or `--dry-run` (`{oldId, newId, fromGroup, toGroup, rewrites}`); REST `POST /v1/tickets/{ticket_id}:move`. A done or canceled ticket, or the current group: `ERR_TICKET_MOVE_REFUSED`.

## Commands on this page

- [`tkt ticket update`](/en/docs/reference/commands/ticket.md#tkt-ticket-update): Partial-update a ticket (merge-patch)
- [`tkt ticket move`](/en/docs/reference/commands/ticket.md#tkt-ticket-move): Move a ticket to another primary group: its id changes, every reference follows
- [`tkt ticket new`](/en/docs/reference/commands/ticket.md#tkt-ticket-new): Create a new ticket
- [`tkt ticket delete`](/en/docs/reference/commands/ticket.md#tkt-ticket-delete): Hard-delete a ticket

## Related

- Concept: [Refs and mentions](/en/docs/concepts/refs.md): How a ticket points at docs, gotchas, code and decisions: explicit refs and mentions in the text.
- Error code · 409: [`ERR_STATUS_TRANSITION`](/en/docs/reference/errors.md#ERR_STATUS_TRANSITION): The status change is not allowed from the current status
- Error code · 409: [`ERR_TICKET_MOVE_REFUSED`](/en/docs/reference/errors.md#ERR_TICKET_MOVE_REFUSED): A closed ticket, or the group it is already in
- Error code · 422: [`ERR_DEFER_REASON_INVALID`](/en/docs/reference/errors.md#ERR_DEFER_REASON_INVALID): A status reason on an update that does not defer or cancel
- Error code · 422: [`ERR_SUPERSEDED_BY_INVALID`](/en/docs/reference/errors.md#ERR_SUPERSEDED_BY_INVALID): A successor on a ticket that stays open, or the ticket itself as its own successor
- Error code · 409: [`ERR_GROUP_PRIMARY_LOCKED`](/en/docs/reference/errors.md#ERR_GROUP_PRIMARY_LOCKED): The primary group changes only through tkt ticket move
- Hint · block: [`TICKET_DEFERRED`](/en/docs/reference/hints.md#TICKET_DEFERRED): The ticket is deferred on purpose (block\_reason: "deferred"): do not start it
- Error code · 422: [`ERR_TICKET_CONTENT_MISSING`](/en/docs/reference/errors.md#ERR_TICKET_CONTENT_MISSING): A new ticket without a filled body ## Description, or a feature or bug without a filled acceptance criterion; nothing written
- Error code · 409: [`ERR_TICKET_CONTENT_REMOVED`](/en/docs/reference/errors.md#ERR_TICKET_CONTENT_REMOVED): An update would empty the ticket's ## Description or remove a feature's or bug's last acceptance criterion; nothing written
- Hint · warning: [`SUPERSEDED_TICKET`](/en/docs/reference/hints.md#SUPERSEDED_TICKET): A ticket this one points at was superseded; for blockedBy the command to repoint it (info when closed)
- Hint · warning: [`BLOCKER_CANCELED`](/en/docs/reference/hints.md#BLOCKER_CANCELED): A blockedBy ticket was canceled
