CommandCodeAI / CommandCodeAI/command-code

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

未关闭
#856 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
没有语言数据
星标
4k
派生
350
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从调用 shell-quote 的命令解析路径开始,然后检查堆栈跟踪中的 parse.js 位置以及周围的 promise 错误处理。识别一个会触发替换失败的输入,并验证该命令要么能够运行,要么产生一个已处理且清晰的验证错误,而不是未处理的拒绝。

由索引模型根据 Issue 内容生成。

评估

技术栈
bash, node.js
领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
需要澄清
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。