opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Opencode will not launch if you set Agent permissions as True/False instead of Allow/Deny

Open RealLukeManning opened this issue 4 days ago • 3 comments

Description

Started using opencode for the first time. Tried migrating some agents I had in Claude Code. Didn't read the documentation properly and set permissions as boolean true/false instead of allow/deny like the documentation states. Once I did that and saved my agent file, opencode just straight up refused to launch, but gave zero indication as to why.

Plugins

None

OpenCode version

1.1.13

Steps to reproduce

You can reproduce with this markdown:

---
description: Test agent
mode: subagent
tools:
  read: true
permission:
  write: false
---

# Test Agent

This is a minimal test agent to debug the loading issue.

Save this to .opencode/agent/testing.md then try to launch opencode in your project directory.

Launching opencode just hangs here forever:

luke@wsl-desktop:~/projects/myproject$ opencode --print-logs --log-level DEBUG
INFO  2026-01-11T15:28:46 +361ms service=default version=1.1.13 args=["--print-logs","--log-level","DEBUG"] opencode
INFO  2026-01-11T15:28:46 +2ms service=config path=/home/luke/.config/opencode/config.json loading
INFO  2026-01-11T15:28:46 +1ms service=config path=/home/luke/.config/opencode/opencode.json loading
INFO  2026-01-11T15:28:46 +3ms service=config path=/home/luke/.config/opencode/opencode.jsonc loading

Logging unfortunately gave me nothing of note other than this one line:

ERROR 2026-01-11T15:28:47 +11ms service=default e=ConfigInvalidError exception

Screenshot and/or share link

N/A

Operating System

Ubuntu 22.04.5 (Windows WSL2)

Terminal

Windows Terminal


My Ask

I've figured this out - so I'm good for now. However I really wish there was a clearer indication of the problem here so I wasn't scratching my head and going off down rabbit holes trying to figure this out.

RealLukeManning avatar Jan 11 '26 15:01 RealLukeManning

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

  • #7483: ConfigInvalidError on Windows due to unrecognized keys - Similar config validation error preventing launch
  • #7791: Schema.ref 'QuestionInfo' validation error in v1.1.x - Related schema validation issue causing startup failures

Both issues describe ConfigInvalidError exceptions that prevent OpenCode from launching due to invalid configuration. Your issue involves invalid permission format (true/false instead of allow/deny), which appears to be a schema validation problem similar to these reported cases.

Feel free to ignore if your issue involves a distinctly different aspect or if these don't match your specific error.

github-actions[bot] avatar Jan 11 '26 15:01 github-actions[bot]

My PR fixes the crash for true/false, but error messages for other invalid config values still don't display clearly.

One potential solution would be to enhance the worker thread error handlers in packages/opencode/src/cli/cmd/tui/worker.ts to format errors using FormatError() and display them via console.error():

process.on("unhandledRejection", (e) => {
  const formatted = FormatError(e)
  Log.Default.error("rejection", {
    e: e instanceof Error ? e.name : e,
    formatted,
  })
  if (formatted) console.error(formatted)
})

process.on("uncaughtException", (e) => {
  const formatted = FormatError(e)
  Log.Default.error("exception", {
    e: e instanceof Error ? e.name : e,
    formatted,
  })
  if (formatted) console.error(formatted)
})

However, I'm not sure if maintainers would prefer this approach, so I did not implement it.

itstrivial avatar Jan 11 '26 20:01 itstrivial

I am personally fine with either:

  1. Your Fix
  2. Better outputs to help diagnosis

If we can get both, great. If we can get your PR fix, great.

RealLukeManning avatar Jan 11 '26 22:01 RealLukeManning