anomalyco / anomalyco/opencode

run: -f FILE followed by a positional prompt swallows the prompt as a file path

Open
#45,501 2 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 27, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

opencode run -f <file> "<prompt>" treats the trailing positional prompt as another file argument and fails with File not found: <your prompt text>. Both -f/--file and the message positional are declared as arrays, so yargs greedily consumes the positional into -f.

Workaround is to put the message before the flag (opencode run "<prompt>" -f <file>), but the natural flag-then-prompt order failing makes -f look broken.

Also worth noting: the failure exits 0, so scripts can't detect it.

OpenCode version

1.18.23 (brew tap, macOS). Also previously reproduced against main on 2026-08-21.

Steps to reproduce
  1. opencode run -m deepseek/deepseek-v4-flash -f /etc/hosts "summarize this" < /dev/null
  2. Output: Error: File not found: summarize this (exit code 0)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.