Commands are not executed properly with proper markdown #4048

Closed
opened 2026-02-16 17:42:25 -05:00 by yindo · 3 comments
Owner

Originally created by @aklajnert on GitHub (Jan 1, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

I have noticed a strange behavior in 1.0.222, not sure if it was before. I had an x in front of the first --- in my command markdown file. After consulting the docs I have noticed that it shouldn't be there, so I have removed it. I was surprised to notice, that such command doesn't work correctly.

I have prepared a minimal example:

---
description: "Just a simple test prompt"
agent: agent
---

Write "hello" in a response and finish.

The result of running it is as below, and it just stays there forever:

Image

Once I have added back the x as a first character of the file, the command works:

Image

It is the same behavior in the TUI and Opnecode Desktup.

OpenCode version

1.0.222

Steps to reproduce

Create a file with the following content at .opencode/command/test-prompt.md, and run /test-prompt.

---
description: "Just a simple test prompt"
agent: agent
---

Write "hello" in a response and finish.

Operating System

Zorin OS (based on Ubuntu 22.04)

Terminal

No response

Originally created by @aklajnert on GitHub (Jan 1, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description I have noticed a strange behavior in `1.0.222`, not sure if it was before. I had an `x` in front of the first `---` in my command markdown file. After consulting the docs I have noticed that it shouldn't be there, so I have removed it. I was surprised to notice, that such command doesn't work correctly. I have prepared a minimal example: ``` --- description: "Just a simple test prompt" agent: agent --- Write "hello" in a response and finish. ``` The result of running it is as below, and it just stays there forever: <img width="1198" height="421" alt="Image" src="https://github.com/user-attachments/assets/b3311f04-720e-4f4f-a679-a9f6271f4a3b" /> Once I have added back the `x` as a first character of the file, the command works: <img width="1196" height="521" alt="Image" src="https://github.com/user-attachments/assets/153b6167-e9c9-4e8a-a716-9d83ab898ca9" /> It is the same behavior in the TUI and Opnecode Desktup. ### OpenCode version 1.0.222 ### Steps to reproduce Create a file with the following content at `.opencode/command/test-prompt.md`, and run `/test-prompt`. ``` --- description: "Just a simple test prompt" agent: agent --- Write "hello" in a response and finish. ``` ### Operating System Zorin OS (based on Ubuntu 22.04) ### Terminal _No response_
yindo added the bug label 2026-02-16 17:42:25 -05:00
yindo closed this issue 2026-02-16 17:42:25 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 1, 2026):

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

  • #3537: Custom slash commands can crash opencode on startup (YAML parsing issues with frontmatter)
  • #2460/#2461: model field in slash command frontmatter appears to be ignored
  • #3329: Custom commands with agents should change to the agent session

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

@github-actions[bot] commented on GitHub (Jan 1, 2026): This issue might be a duplicate of existing issues. Please check: - #3537: Custom slash commands can crash opencode on startup (YAML parsing issues with frontmatter) - #2460/#2461: `model` field in slash command frontmatter appears to be ignored - #3329: Custom commands with agents should change to the agent session Feel free to ignore if none of these address your specific case.
Author
Owner

@Leka74 commented on GitHub (Jan 1, 2026):

The issue is not the formatting. It's that in this case the agent agent doesn't exist. Adding a x technically fixes it cause its an invalid markdown then, so the default agent is used.

Anyway I created a PR to at least show an error when an agent name is invalid (https://github.com/sst/opencode/pull/6578)

@Leka74 commented on GitHub (Jan 1, 2026): The issue is not the formatting. It's that in this case the agent `agent` doesn't exist. Adding a `x` technically fixes it cause its an invalid markdown then, so the default agent is used. Anyway I created a PR to at least show an error when an agent name is invalid (https://github.com/sst/opencode/pull/6578)
Author
Owner

@aklajnert commented on GitHub (Jan 1, 2026):

Oh, that makes sense. I was converting the prompt from Github Copilot, and the agent: agent is perfectly valid there. A meaningful error would be very helpful here.

@aklajnert commented on GitHub (Jan 1, 2026): Oh, that makes sense. I was converting the prompt from [Github Copilot](https://code.visualstudio.com/docs/copilot/customization/prompt-files), and the `agent: agent` is perfectly valid there. A meaningful error would be very helpful here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4048