`gh label list --json` prints nothing instead of `[]` when the repository has no labels
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #15069 de @deepak26ba — cerrado sin fusionar
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza siguiendo la ruta de salida del comando gh label list --json y compárala con gh variable list --json, que devuelve [] cuando el resultado está vacío. Añade o actualiza una prueba de regresión para un repositorio sin etiquetas; el trabajo estará terminado cuando el comando imprima JSON válido que contenga [] y finalice correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
gh label list --json prints nothing when the repository has no labels. I expected an empty JSON array ([]), like gh variable list --json prints when there are no variables.
The empty output cannot be parsed as JSON, causing scripts that expect JSON to fail.
Affected version
gh version 2.104.0 (2026-11-12)
https://github.com/cli/cli/releases/tag/v2.104.0
Steps to reproduce the behavior
- Pick a repository with no labels.
- Run
gh label list --repo OWNER/REPO --json name,color,description; echo $? - Nothing is printed to stdout, and the exit status is 0.
Expected vs actual behavior
Expected: [] is printed.
Actual: nothing is printed.
Logs
$ GH_DEBUG=api gh label list --repo mono0x/202611-gh-cli-test --json name,color,description; echo $?
* Request at 2026-11-17 00:25:02.025048 +0900 JST m=+0.013274501
* Request to https://api.github.com/graphql
⣾> POST /graphql HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token ████████████████████
> Content-Length: 612
> Content-Type: application/json; charset=utf-8
> Graphql-Features: merge_queue
> Time-Zone: Asia/Tokyo
> User-Agent: GitHub CLI 2.104.0
> X-Github-Api-Version: 2022-11-28
GraphQL query:
fragment label on Label{name,color,description}
query LabelList($owner: String!, $repo: String!, $limit: Int!, $endCursor: String, $query: String, $orderBy: LabelOrder) {
repository(owner: $owner, name: $repo) {
labels(first: $limit, after: $endCursor, query: $query, orderBy: $orderBy) {
totalCount,
nodes {
...label
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
GraphQL variables: {"limit":30,"orderBy":{"direction":"ASC","field":"CREATED_AT"},"owner":"mono0x","query":"","repo":"202611-gh-cli-test"}
⣟< HTTP/2.0 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Mon, 16 Nov 2026 15:25:02 GMT
< Github-Authentication-Token-Expiration: 2026-11-16 19:44:44 UTC
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: github.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Accepted-Oauth-Scopes: repo
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Edge-Region: japaneast
< X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
< X-Github-Request-Id: 560E:186A2B:10552E:1A4AD2:6AFB204E
< X-Oauth-Client-Id: ...
< X-Oauth-Scopes:
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4993
< X-Ratelimit-Reset: 1794843665
< X-Ratelimit-Resource: graphql
< X-Ratelimit-Used: 7
< X-Xss-Protection: 0
{
"data": {
"repository": {
"labels": {
"totalCount": 0,
"nodes": [],
"pageInfo": {
"hasNextPage": false,
"endCursor": null
}
}
}
}
}
* Request took 671.448417ms
no labels found in mono0x/202611-gh-cli-test
0
$ GH_DEBUG=api gh variable list --repo mono0x/202611-gh-cli-test --json name; echo $?
* Request at 2026-11-17 00:25:05.581033 +0900 JST m=+0.013615751
* Request to https://api.github.com/repos/mono0x/202611-gh-cli-test/actions/variables?per_page=100
> GET /repos/mono0x/202611-gh-cli-test/actions/variables?per_page=100 HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token ████████████████████
> Content-Type: application/json; charset=utf-8
> Time-Zone: Asia/Tokyo
> User-Agent: GitHub CLI 2.104.0
> X-Github-Api-Version: 2022-11-28
< HTTP/2.0 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning
< Cache-Control: private, max-age=60, s-maxage=60
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Mon, 16 Nov 2026 15:25:05 GMT
< Etag: W/"988058d477a27e2fe8e704bd6bec500341777e328edf9697cfe2e4bcb93fadf9"
< Github-Authentication-Token-Expiration: 2026-11-16 19:44:44 UTC
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: github.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With
< X-Accepted-Github-Permissions: actions_variables=read
< X-Accepted-Oauth-Scopes:
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Edge-Region: japaneast
< X-Github-Media-Type: github.v3; param=merge-info-preview.nebula-preview; format=json
< X-Github-Request-Id: DDF6:2574DA:12654B:1DE911:6AFB2051
< X-Oauth-Client-Id: ...
< X-Oauth-Scopes:
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4962
< X-Ratelimit-Reset: 1794843187
< X-Ratelimit-Resource: core
< X-Ratelimit-Used: 38
< X-Xss-Protection: 0
{
"variables": [],
"total_count": 0
}
* Request took 368.840584ms
[]
0
- Lenguaje dominante
- Go
- Estrellas
- 47.4k
- Forks
- 9.5k
- Merge medio
- 18 h 34 min
- PR fusionados (30 d)
- 70
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cli/cli
-
`gh search prs --locked=false` silently ignores the requested search filterQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug gh-search priority-3
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
cli/cli#15188 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
`gh run watch` drops annotations for jobs that are queued on the first pollQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug gh-run priority-3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
cli/cli#15186 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
gh skill update reports success when a repository cannot be resolvedQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug gh-skill priority-3
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
cli/cli#15092 · 4 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
`gh search code '"term"'` sends the typed quotes escaped (`q="\"term\""`) and finds nothingQuizá libre de nuevo @Daiyuanranfeng la tomó hace 17 días y no hay ningún pull request abierto. Abiertoauto-bugfix-fixing bug gh-search priority-3
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
cli/cli#15060 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
`gh run cancel` reports "Cannot cancel a workflow run that is completed" for any HTTP 409, hiding the real API errorQuizá libre de nuevo @muadzhdz la tomó hace 19 días y no hay ningún pull request abierto. Abiertobug gh-run priority-3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cli/cli#15053 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Issues similares
-
kind: for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
monumental-archive/.github#2279 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
[Docs] Fix duplicate /gRPC protocol suffix and Kubernetes typo on Architecture pagePosiblemente ocupada @Apocalypse10110 la tomó hoy. Abiertoarea/docs framework/hugo help wanted language/markdown
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
meshery/meshery#24946 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
XHTTP over HTTP/3 with `finalmask.quicParams.congestion: "brutal"` panics at the first dial; `-test` passesPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster no-stale P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openclaw/crabbox#3249 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día