Shell output (backticks) in custom slash commands produce an error #1877

Closed
opened 2026-02-16 17:33:03 -05:00 by yindo · 4 comments
Owner

Originally created by @rstacruz on GitHub (Sep 29, 2025).

Originally assigned to: @rekram1-node on GitHub.

Create a command with a shell output expression:

This is the result of the command:

!`echo hello`

This becomes like so:

This is the result of the command:

Error executing command: Invalid JS object used in shell: [object Object], you might need to call `.toString()` on it

This seems to happen with 0.13.0 and 0.13.4.

My environment: macOS + Fish shell, and Linux + Fish shell (not sure if Fish has anything to do with it tho).

A workaround is to downgrade to 0.11.4.

Originally created by @rstacruz on GitHub (Sep 29, 2025). Originally assigned to: @rekram1-node on GitHub. Create a command with a shell output expression: ``` This is the result of the command: !`echo hello` ``` This becomes like so: ``` This is the result of the command: Error executing command: Invalid JS object used in shell: [object Object], you might need to call `.toString()` on it ``` This seems to happen with 0.13.0 and 0.13.4. My environment: macOS + Fish shell, and Linux + Fish shell (not sure if Fish has anything to do with it tho). A workaround is to downgrade to 0.11.4.
yindo closed this issue 2026-02-16 17:33:03 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 29, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2233: Shell commands don't appear to expand in custom commands - This issue specifically discusses backticks with shell commands (like !git status) not expanding properly in custom slash commands
  • #1475: Backticks in output at premature termination at opencode responses - Related to backticks causing issues with response handling

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 29, 2025): This issue might be a duplicate of existing issues. Please check: - #2233: Shell commands don't appear to expand in custom commands - This issue specifically discusses backticks with shell commands (like `!git status`) not expanding properly in custom slash commands - #1475: Backticks in output at premature termination at opencode responses - Related to backticks causing issues with response handling Feel free to ignore if none of these address your specific case.
Author
Owner

@rstacruz commented on GitHub (Sep 29, 2025):

For full disclosure, this was the prompt I used:

---
description: Edit the PR description and title
---

You are a senior software engineer. Edit the PR description and PR title.

To do:

- Consult `gh pr diff` to understand what changed.
- Consult the template for the PR description.
- Consult `CONTEXT.local.md` if it exists. This file can contain additional context.
- Read any files to understand what might be needed.

Using the template:

- Consult `.github/pull_request_template.md` for the PR template, if it exists.
- If `.github/pull_request_template.local.md` exists, use that instead.
- If neither file exists, create a sensible PR description. Try to include sections on "Background", "Changes". Use bullet points.

Tools:

- Use the `gh` CLI tool.
- Be sure to escape backticks.

<context command="gh pr diff" description="Current PR changes">
!`gh pr diff`
</context>

<context command="git status" description="See if there are uncommitted changes">
!`git status`
</context>

<context command="git diff">
!`git diff`
</context>

<context command="cat CONTEXT.local.md" description="Local context, if it exists">
!`cat CONTEXT.local.md`
</context>

<context command="git log origin/main...HEAD" description="All commits since branching from main">
!`git log origin/main...HEAD`
</context>

<context command="cat .github/pull_request_template.local.md" description="Local PR template, if it exists">
!`cat .github/pull_request_template.local.md`
</context>

<context command="cat .github/pull_request_template.md" description="Default PR template, if local doesn't exist">
!`cat .github/pull_request_template.md`
</context>
@rstacruz commented on GitHub (Sep 29, 2025): For full disclosure, this was the prompt I used: ``` --- description: Edit the PR description and title --- You are a senior software engineer. Edit the PR description and PR title. To do: - Consult `gh pr diff` to understand what changed. - Consult the template for the PR description. - Consult `CONTEXT.local.md` if it exists. This file can contain additional context. - Read any files to understand what might be needed. Using the template: - Consult `.github/pull_request_template.md` for the PR template, if it exists. - If `.github/pull_request_template.local.md` exists, use that instead. - If neither file exists, create a sensible PR description. Try to include sections on "Background", "Changes". Use bullet points. Tools: - Use the `gh` CLI tool. - Be sure to escape backticks. <context command="gh pr diff" description="Current PR changes"> !`gh pr diff` </context> <context command="git status" description="See if there are uncommitted changes"> !`git status` </context> <context command="git diff"> !`git diff` </context> <context command="cat CONTEXT.local.md" description="Local context, if it exists"> !`cat CONTEXT.local.md` </context> <context command="git log origin/main...HEAD" description="All commits since branching from main"> !`git log origin/main...HEAD` </context> <context command="cat .github/pull_request_template.local.md" description="Local PR template, if it exists"> !`cat .github/pull_request_template.local.md` </context> <context command="cat .github/pull_request_template.md" description="Default PR template, if local doesn't exist"> !`cat .github/pull_request_template.md` </context> ```
Author
Owner

@rekram1-node commented on GitHub (Sep 29, 2025):

hmm will investigate

@rekram1-node commented on GitHub (Sep 29, 2025): hmm will investigate
Author
Owner

@rekram1-node commented on GitHub (Sep 29, 2025):

should be fixed in next release

@rekram1-node commented on GitHub (Sep 29, 2025): should be fixed in next release
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1877