Skip to content

opencode run exits silently with no output in a non-git directory (GLM 5.1) #28605

@jzh18

Description

@jzh18

Description

Description

When running opencode in headless mode (opencode run "...") from a directory that does not contain a
.git folder, the command exits without printing the assistant's response. No error, no stack trace. it
just produces empty output. The same prompt works fine in interactive mode, and works fine in headless
mode as soon as a .git directory is present.

This suggests headless mode has a code path that depends on being inside a git repository.

Steps to reproduce

  1. Create a directory with no git repo:
    mkdir /tmp/no-git-test && cd /tmp/no-git-test
  2. Run opencode in headless mode with the GLM 5.1 model:
    opencode run "say hi"
  3. Observe: command exits with no response from the agent.
Image
  1. Now initialize git and retry:
  git init
  opencode run "say hi"
  1. Observe: it works and prints the response.
Image

Expected behavior

opencode run should print the agent's response regardless of whether the working directory is a git
repository.

Actual behavior

  • Headless, no .git → exits silently, no output. ❌
  • Headless, with .git → works as expected. ✅
  • Interactive mode, no .git → works as expected. ✅

Environment

  • opencode version: 1.15.6
  • Model / provider: GLM 5.1 (zai-coding-plan/glm-5.1)
  • OS: Linux (kernel 6.8.0)
  • Shell: zsh

Plugins

No

OpenCode version

1.15.6

Steps to reproduce

  1. Create a directory with no git repo:
    mkdir /tmp/no-git-test && cd /tmp/no-git-test
  2. Run opencode in headless mode with the GLM 5.1 model:
    opencode run "say hi"
  3. Observe: command exits with no response from the agent.
Image
  1. Now initialize git and retry:
  git init
  opencode run "say hi"
  1. Observe: it works and prints the response.
Image

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions