Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
This repository was archived by the owner on May 15, 2026. It is now read-only.

Command validation fails with 'Bad substitution' error on shell array indexing #3529

Closed

Description

@KJ7LNW

When using shell array indexing expressions like ${array[var]}, command validation fails with error:

Bad substitution: levels[31224

This occurs when trying to validate shell commands that use array indexing with variables, such as:

level=${levels[30232 % ${#levels[@]}]}

The error is thrown by the shell-quote library when parsing these expressions.

Activity

  1. dosubot commented on May 13, 2025

    @dosubot

    I couldn't find specific information on how Roo Code's command validation handles shell array indexing or the "Bad substitution" error in the documentation. However, it seems that the issue might be related to how the shell-quote library parses these expressions. You might want to check if there are any open issues or discussions related to this in the repository. Additionally, consider looking into alternative ways to handle array indexing or variable substitution that might be compatible with the current parsing logic.

    To continue talking to Dosu, mention @dosu.


    Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

  2. KJ7LNW commented on May 13, 2025

    @KJ7LNW
    ContributorAuthor

    Created upstream issue in shell-quote repository: ljharb/shell-quote#19

    The issue appears to be in the shell-quote library's handling of nested parameter expansion inside array indexing expressions. Added a minimal reproducer showing the specific parsing failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions