[bug-bash] Invalid command arguments return general-failure exit 1 instead of documented usage exit 2
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 68/100
Direção de pesquisa
Start by reading docs/ci.md and docs/navigation.md to confirm the exit-code contract, then trace how command argument validation errors are mapped to exit codes; the issue points to ArgumentException, JsonException, CommandNotFoundException, and plain CommandException paths. Reproduce the three commands in PowerShell without a database connection. Done when missing or invalid arguments return 2 while runtime failures retain their documented classification.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Environment
Windows x64, CosmosDBShell 1.1.291-preview (db49321323).
No database connection is required.
Repro (PowerShell)
$package = "$env:USERPROFILE\.dotnet\tools\.store\cosmosdbshell\1.1.291-preview"
$shell = Join-Path $package 'cosmosdbshell.win-x64\1.1.291-preview\tools\net10.0\win-x64\CosmosDBShell.exe'
& $shell --version
$work = Join-Path ([IO.Path]::GetTempPath()) ("cosmos-usage-" + [guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $work | Out-Null
Set-Location $work
& $shell --output json -c 'echo [1] | filter'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"Missing required parameter: ExpressionText"}
Actual exit code: 1.
Another example:
'[{"id":"a","pk":"a"}]' | Set-Content .\sample.json
& $shell --output json -c 'import sample.json --dry-run --concurrency 0'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"Concurrency must be a positive integer."}
Actual exit code: 1.
Third exact command:
& $shell --output json -c 'echo [{"id":"a"}] | ftab --format invalid'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"The -format option must be one of: default, markdown, html."}
Actual exit code: 1.
Expected
The documented exit-code contract in docs/ci.md
and docs/navigation.md assigns
code 2 to usage errors, invalid/bad arguments, and unknown options. Code 1 is
for failures that do not fit a more specific category. A missing required
parameter and an invalid concurrency argument should therefore classify as 2.
Working control
An unknown command or unknown app-level option correctly returns exit code 2.
Impact
CI wrappers cannot consistently distinguish incorrect invocation from a runtime
failure using the published exit-code contract.
Investigation lead
The current source maps ArgumentException, JsonException, and
CommandNotFoundException to usage errors. Several argument-validation paths
instead create a plain CommandException without a classified inner exception,
which falls through to general failure. This is a candidate root cause,
not a verified fix.
Reproduced against the installed release.
- Linguagem predominante
- C#
- Estrelas
- 4
- Forks
- 7
- Merge médio
- 1d 23h
- PRs com merge (30d)
- 23
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de Azure/CosmosDBShell
-
[bug-bash] print maps a missing item's HTTP 404 to exit 1 instead of documented not-found exit 5Talvez já em andamento @mkrueger assumiu há 1 dia. Abertabug bug-bash
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Azure/CosmosDBShell#279 ·
Mantenedores costumam responder em até 1 dia
-
[bug-bash] Sequential script commands leak their result into rm as implicit pipe inputTalvez já em andamento @mkrueger assumiu há 1 dia. Abertabug bug-bash
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 75/100
Azure/CosmosDBShell#281 ·
Mantenedores costumam responder em até 1 dia
-
[bug-bash] edit and theme failures silently return exit 1 without a machine-readable stderr errorTalvez já em andamento @mkrueger assumiu há 1 dia. Abertabug bug-bash
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
Azure/CosmosDBShell#278 ·
Mantenedores costumam responder em até 1 dia
-
[bug-bash] Multi-statement -c and piped stdin silently drop intermediate output and file redirectionsTalvez já em andamento @mkrueger assumiu há 1 dia. Abertabug bug-bash
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 75/100
Azure/CosmosDBShell#277 ·
Mantenedores costumam responder em até 1 dia
-
Connection to mcp failed?Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
Azure/CosmosDBShell#274 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de Azure/CosmosDBShell
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 80/100
Unity-Technologies/unity-agent-plugin#118 ·
Mantenedores costumam responder em até 1 dia
-
The Recommended preset turns on Import Uno DSP, which only works with the Material themeTalvez já em andamento @agneszitte assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
unoplatform/uno.templates#2388 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
eyalgolan/statecraft-israel#2732 ·
Mantenedores costumam responder em até 1 dia
-
変換の候補のどれが Zenzai の答えか分からないAberta要トリアージ
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
Mantenedores costumam responder em até 1 dia
-
kind/chore status/draft
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
Altinn/altinn-events#1158 ·
Mantenedores costumam responder em até 1 dia