-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
bugSomething isn't workingSomething isn't workinggh-projectrelating to the gh project commandrelating to the gh project commandpriority-2Affects more than a few users but doesn't prevent core functionsAffects more than a few users but doesn't prevent core functions
Description
Describe the bug
gh project edit fails with a GraphQL error on user-owned ProjectV2:
Variable $query is used by UpdateProjectV2 but not declared (mutation UpdateProjectV2.updateProjectV2.projectV2.items.query)
This appears to be a CLI-side query construction bug (not user input), because the same update works via direct GraphQL mutation using gh api graphql.
Steps to reproduce
- Authenticate with project scopes.
- Ensure a user-owned project exists (example: project number
2under ownerKamelOtmani). - Run:
gh project edit 2 --owner KamelOtmani --description "repro-test desc"Also reproducible with other flags:
gh project edit 2 --owner KamelOtmani --title "Project"
gh project edit 2 --owner KamelOtmani --readme "hello"Expected behavior
Project metadata updates successfully.
Actual behavior
Command fails with:
GraphQL: Variable $query is used by UpdateProjectV2 but not declared (mutation UpdateProjectV2.updateProjectV2.projectV2.items.query)
Debug output excerpt
With GH_DEBUG=api:
- CLI sends mutation
UpdateProjectV2(...)whose selection includes:
items(first: $firstItems, after: $afterItems, query: $query) - But variables only include:
{"afterFields":null,"afterItems":null,"firstFields":0,"firstItems":0,"input":{...}} - No
$queryvariable is declared/passed.
Server responds with variableNotDefined for query.
Workaround
Direct GraphQL mutation works:
gh api graphql \
-f query='mutation($projectId:ID!,$shortDescription:String!){ updateProjectV2(input:{projectId:$projectId, shortDescription:$shortDescription}) { projectV2 { id title shortDescription } } }' \
-f projectId='PVT_kwHOAJ4Xxs4BP7US' \
-f shortDescription='repro via api works'Environment
gh version 2.87.2 (2026-02-20)- Linux (x64)
- Auth scopes include
project
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggh-projectrelating to the gh project commandrelating to the gh project commandpriority-2Affects more than a few users but doesn't prevent core functionsAffects more than a few users but doesn't prevent core functions