[bug-bash] Invalid command arguments return general-failure exit 1 instead of documented usage exit 2
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- C#
- 星號
- 4
- 分支
- 7
- 平均合併
- 2 天 2 小時
- 30 天內合併 PR
- 24
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Azure/CosmosDBShell 的其他 Issue
-
[bug-bash] print maps a missing item's HTTP 404 to exit 1 instead of documented not-found exit 5未關閉bug bug-bash
難度 2/5 1-3 小時 新手友好度 78/100
Azure/CosmosDBShell#279 ·
維護者通常 1 天內回覆
-
bug bug-bash
難度 3/5 1-2 天 新手友好度 75/100
Azure/CosmosDBShell#281 ·
維護者通常 1 天內回覆
-
[bug-bash] edit and theme failures silently return exit 1 without a machine-readable stderr error未關閉bug bug-bash
難度 3/5 1-2 天 新手友好度 62/100
Azure/CosmosDBShell#278 ·
維護者通常 1 天內回覆
-
bug bug-bash
難度 3/5 1-2 天 新手友好度 75/100
Azure/CosmosDBShell#277 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 35/100
Azure/CosmosDBShell#274 · 1 則留言 ·
維護者通常 1 天內回覆
查看 Azure/CosmosDBShell 的全部 Issue
相似的 Issue
-
bug github_actions
難度 2/5 1-3 小時 新手友好度 78/100
endercodezz/BYDLO#336 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
-
難度 2/5 1-3 小時 新手友好度 85/100
sebastienros/jint#4449 ·
維護者通常 1 天內回覆
-
clawsweeper:bulk-filed clawsweeper:needs-security-review clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:security issue-rating: 🦞 diamond lobster P2
難度 2/5 1-3 小時 新手友好度 82/100
openclaw/openclaw-windows-node#2010 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
imazen/imageflow-dotnet#72 · 1 則留言 ·