CommandCodeAI / CommandCodeAI/command-code

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

Đang mở
#856 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
4k
Fork
350
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với luồng phân tích lệnh gọi shell-quote, sau đó kiểm tra các vị trí parse.js trong stack trace và phần xử lý lỗi promise xung quanh. Xác định một đầu vào kích hoạt lỗi thay thế và xác minh rằng lệnh либо chạy được hoặc tạo ra lỗi xác thực rõ ràng đã được xử lý, thay vì một rejection chưa được xử lý.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
bash, node.js
Lĩnh vực
cli
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.