Unhandled Promise Rejection: Bad substitution: chunks[1].startOffset

未關閉
#856 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
活躍
技術堆疊
bash, node.js
領域
cli

研究方向

從呼叫 shell-quote 的命令解析路徑開始,接著檢查堆疊追蹤中的 parse.js 位置,以及周圍的 promise 錯誤處理。找出一個會觸發替換失敗的輸入,並驗證該命令要麼能夠執行,要麼產生一個已處理且清楚的驗證錯誤,而不是未處理的拒絕。

由索引模型根據 Issue 內容生成。

描述

Summary

Command Code crashes with an unhandled promise rejection when parsing a shell command.

Environment:

  • OS: Ubuntu Linux
  • Node.js: v22.20.0
  • Command Code: latest installed version
  • Shell: [bash/zsh/etc.]

Error:
CRITICAL: Unhandled Promise Rejection!
This is an unexpected error. Please file a bug report.

ERROR: Error
REASON → Bad substitution: chunks[1].startOffset

Stack trace:
Error: Bad substitution: chunks[1].startOffset
at parseEnvVar (.../command-code/node_modules/shell-quote/parse.js:171:12)
at .../command-code/node_modules/shell-quote/parse.js:256:17
at Array.map ()
at parseInternal (.../command-code/node_modules/shell-quote/parse.js:113:17)
at parse (.../command-code/node_modules/shell-quote/parse.js:309:15)
...

Trace ID:
c58b9fbd1d12acef3534f9db896e4142

The error appears to originate while parsing the shell command/environment
variable substitution through the shell-quote dependency.

Image
Expected Behavior

The command should either execute normally or return a handled/clear
validation error rather than crashing with an unhandled promise rejection.

Actual Behavior

The command should either execute normally.

Steps to reproduce the issue

The issue doesn’t require reproduction.

Command Code Version

1.53.0

Operating System

Linux

Terminal/IDE

Terminal

Shell

bash

Session file (optional)

No response

Fix prompt (optional)

No response

Additional context

This was reproduced on Ubuntu with Node.js v22.20.0.

主要語言
沒有語言資料
星號
4k
分支
350
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

CommandCodeAI/command-code 的其他 Issue

查看 CommandCodeAI/command-code 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。