Skip to content

[Bug]: oh-my-opencode run --agent Librarian crashes with "undefined is not an object (evaluating 'agent.model')" #2427

@qingduzhai

Description

@qingduzhai

Bug Description

Running oh-my-opencode run --agent Librarian fails before any assistant/user message is persisted. The session is created, but the run immediately throws undefined is not an object (evaluating 'agent.model') and then only polls /session/status until timeout/exit.

This does not look like a generic provider outage because:

  • oh-my-opencode run works in the same project/config
  • oh-my-opencode run --agent Sisyphus also works in the same project/config
  • Atlas can at least enter a session and persist messages, even though that path later hits a separate provider-side Not Found

So this looks like a direct --agent Librarian resolution / agent config parsing bug.

Steps to Reproduce

  1. Environment: WSL2 Ubuntu on Windows, OpenCode 1.2.23, oh-my-opencode 3.11.2
  2. Configure librarian to use a valid model:
{
  "agents": {
    "librarian": {
      "model": "minimax/MiniMax-M2.5",
      "category": "quick",
      "reasoningEffort": "low"
    }
  },
  "categories": {
    "quick": {
      "model": "minimax/MiniMax-M2.5",
      "reasoningEffort": "low"
    }
  }
}
  1. Verify the model exists in OpenCode:
opencode models

It includes:

minimax/MiniMax-M2.5
  1. Run:
oh-my-opencode run --agent Librarian --json --no-timestamp 'List deploy_remote.py and app/tests/test_deploy_remote.py only.'

Expected Behavior

The Librarian agent should start normally and return a response, just like Sisyphus does in the same environment.

Actual Behavior

  • A session is created successfully
  • The run then errors very early with:
undefined is not an object (evaluating 'agent.model')
  • After that it keeps polling /session/status
  • The resulting session is effectively empty in sqlite:
ses_329243ea9ffengeI53pZD29j27  messages=0  parts=0
ses_3291c4533ffeeBeenCJ2gljNvr  messages=0  parts=0

For comparison, another failing path (Atlas) at least persisted data:

ses_32924512fffeOt1OjPcC6TWH6M  messages=2  parts=1

Doctor Output

 oMoMoMoMo Doctor 

 ? 1 issue found:

1. GitHub CLI not authenticated
   gh CLI is installed but not logged in.
   Fix: Run: gh auth login
   Affects: GitHub automation

Error Logs

INFO  2026-03-10T08:27:32 +4ms service=server method=POST path=/session/ses_329243ea9ffengeI53pZD29j27/prompt_async request
INFO  2026-03-10T08:27:32 +29ms service=server status=completed duration=29 method=POST path=/session/ses_329243ea9ffengeI53pZD29j27/prompt_async request
ERROR 2026-03-10T08:27:32 +3ms service=default e=undefined is not an object (evaluating 'agent.model') rejection

Relevant log file:

  • /home/woody/.local/share/opencode/log/2026-03-10T082728.log

Configuration

Global config (sanitized):

{
  "default_run_agent": "sisyphus",
  "agents": {
    "sisyphus": {
      "model": "foxcode/gpt-5.4",
      "category": "unspecified-high",
      "reasoningEffort": "high"
    },
    "librarian": {
      "model": "minimax/MiniMax-M2.5",
      "category": "quick",
      "reasoningEffort": "low",
      "prompt_append": "Cheap evidence gatherer. Use for document lookup, quick summaries, and low-ambiguity retrieval work."
    }
  },
  "categories": {
    "quick": {
      "model": "minimax/MiniMax-M2.5",
      "reasoningEffort": "low"
    }
  }
}

Project config (sanitized):

{
  "agents": {
    "librarian": {
      "prompt_append": "Focus on cheap repo evidence gathering: config locations, route definitions, service/schema references, deploy artifacts, and test entry points. Escalate if ambiguity remains."
    }
  }
}

Additional Context

Operating System

Linux (WSL2 Ubuntu on Windows 11)

OpenCode Version

1.2.23

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions