linearis icon indicating copy to clipboard operation
linearis copied to clipboard

`projects update` hits "Query too complex" with no possible workaround flag (mutation payload selects five unbounded connections)

Open jackhutson opened this issue 3 months ago • 2 comments

What happened?

linearis projects update fails with {"error":"Query too complex"} on any workspace of moderate size — and unlike the projects list case (#276), no flag can work around it, because the complexity comes from the mutation's hard-coded response payload.

UpdateProjectDocument (dist/gql/graphql.js) selects projectUpdate(...) { success project { ...ProjectDetailWithDefaultConnectionsFields } }. That fragment chain contains five unbounded connections:

  • ProjectListFields: teams { nodes }, labels { nodes }
  • ProjectDetailFields adds: members { nodes }, initiatives { nodes }
  • ProjectDetailWithDefaultConnectionsFields adds: projectMilestones { nodes }

Linear's estimator charges each unbounded connection at its default page size, so the mutation is rejected before executing. There is no --milestones-first-style knob on update (those exist only on read), and --fields is a client-side post-filter that never changes the selection set.

Aggravator: projects update --labels X --label-mode add|remove first calls getProject() (dist/commands/projects.js:402-405) — the heavy detail query with default 25 milestones + 50 CompleteIssueFields issues — just to read the current label list, so a one-label tweak issues two over-budget requests.

Expected behavior

The mutation succeeds; the update itself is tiny.

Steps to reproduce

linearis projects update "<any project>" --labels "<existing label>" --label-mode add
# → {"error":"Query too complex"}
# same result without --labels, e.g. --content "..." on some workspaces

Suggested fix

Select a thin mutation payload (success project { id name updatedAt }), or bound each inner connection with first:. The @skip-directive pattern GetProjectDocument already uses (dist/services/project-service.js:20-34) would also work. For the --label-mode pre-read, getProject could use the list-weight fragment instead of the full detail fragment.

Linearis version

2026.6.0

Node.js version

v25.x

Operating system

Linux

Authentication method

LINEAR_API_TOKEN env var

Additional context

Root-cause analysis for the read-side variants is in #276. Current workaround is dropping to raw GraphQL (curl https://api.linear.app/graphql with a hand-written thin projectUpdate), which works fine — confirming the API is happy with the mutation itself, and only the CLI's response selection is over budget.

jackhutson avatar Aug 06 '26 01:08 jackhutson

LIN-158

linear[bot] avatar Aug 06 '26 01:08 linear[bot]

Correction to my report after building the fix (#284): the mutation payload itself prices under the complexity budget (single parent row — verified with a nil-UUID probe that passes complexity validation). What actually breaks update --label-mode add|remove is the pre-read: it fetches the full project detail (default milestones + issues with CompleteIssueFields) just to read current label IDs, and that read is what exceeds the budget. #284 replaces it with a lean label-IDs-only query and bounds the fragment connections.

jackhutson avatar Aug 06 '26 04:08 jackhutson