linearis icon indicating copy to clipboard operation
linearis copied to clipboard

`linearis projects list` for a fresh Linear account with one project returns `"error": "Query too complex"`

Open r3clin3r opened this issue 4 months ago • 2 comments

What happened?

I have a new linear account with about 20 issues and a couple of custom labels.

I have created one project.

$ linearis projects list
{
  "error": "Query too complex"
}

Expected behavior

Return json for the one project.

Steps to reproduce

1. `linearis auth login`  # to an account with one project and very little else
2. `linearis projects list`

Actual output

{
  "error": "Query too complex"
}

Linearis version

2026.6.0

Node.js version

v25.7.0

Operating system

Linux

Authentication method

~/.linearis/token (linearis auth login)

Additional context

running linearis projects list --limit 1 is a workaround

r3clin3r avatar Jul 10 '26 11:07 r3clin3r

LIN-155

linear[bot] avatar Jul 10 '26 11:07 linear[bot]

Root-caused this while investigating the same error — it's not account size, and --fields can't help. Sharing findings since they explain why a fresh account with one project still fails.

Cause: the pre-compiled query documents select unbounded nested connections, and Linear's complexity estimator charges each one at its default page size (50) per parent row — regardless of how much data actually exists.

In dist/gql/graphql.js, ProjectListFields selects two connections with no first: argument:

  • teams { nodes { id key name } }
  • labels { nodes { id name color } }

GetProjectsDocument fetches projects(first: $limit) with --limit defaulting to "100" (dist/commands/projects.js:129), so the estimated cost is roughly 100 × (50 teams + 50 labels) ≈ 10k nodes — over the budget before a single byte comes back. That's why one project on a fresh account fails: the estimator prices the potential page, not the actual rows. It also means --fields is irrelevant — pickFields() (dist/common/output.js) filters the already-fetched response client-side and never changes the selection set.

Same root cause hits two more commands:

  1. projects read at defaults — GetProjectDocument's issues use CompleteIssueFields, which itself carries unbounded labels, children, relations, inverseRelations per issue. Workaround: --milestones-first 0 --issues-first 0.
  2. projects update — worse, because there's no workaround flag at all; filed separately as it can't be mitigated client-side.

Suggested fix: bound the inner connections in the fragments (e.g. teams(first: 50), labels(first: 50)), or extend the @skip-directive pattern GetProjectDocument already uses for milestones/issues (dist/services/project-service.js:20-34) to these connections. Either drops projects list --limit 100 back under the budget.

(Observed on 2026.6.0; workaround stats from a corpus of ~600 CLI invocations: 0/20 failures with --limit ≤30, 19/26 without.)

jackhutson avatar Aug 06 '26 01:08 jackhutson