Skip to content

TypeError: matcher.hooks undefined on Windows #441

@MediumsKor

Description

@MediumsKor

Bug Description

When running opencode run with oh-my-opencode plugin enabled on Windows, the following error occurs:

[oh-my-opencode] Downloading comment-checker binary...
17148 |     hook_event_name: "UserPromptSubmit",
17149 |     prompt: ctx.prompt,
17150 |     session: { id: ctx.sessionId },
17151 |     hook_source: "opencode-plugin"
17152 |   };
17153 |     for (const hook of matcher.hooks) {
                                      ^
TypeError: undefined is not an object (evaluating 'matcher.hooks')
      at executeUserPromptSubmitHooks (C:\Users\kmedi\.cache\opencode\node_modules\oh-my-opencode\dist\index.js:17153:31)
      at executeUserPromptSubmitHooks (C:\Users\kmedi\.cache\opencode\node_modules\oh-my-opencode\dist\index.js:17127:45)
      at <anonymous> (C:\Users\kmedi\.cache\opencode\node_modules\oh-my-opencode\dist\index.js:17417:58)

[oh-my-opencode] Failed to download comment-checker: Executable not found in $PATH: "powershell"
[oh-my-opencode] Comment checking disabled.

Environment

  • OS: Windows 11
  • OpenCode Version: 1.0.223
  • oh-my-opencode: latest (installed via bunx oh-my-opencode@latest install)
  • Shell: PowerShell / CMD

Steps to Reproduce

  1. Install oh-my-opencode with bunx oh-my-opencode install --no-tui --claude=yes --gemini=yes
  2. Complete authentication (opencode auth login)
  3. Run opencode run "any prompt"

Expected Behavior

OpenCode should run without errors.

Actual Behavior

TypeError occurs because matcher.hooks is undefined. Additionally, powershell is not found in PATH even though running on Windows.

Workaround

Removing oh-my-opencode from the plugin list in opencode.json allows opencode to run normally.

Additional Context

  • The error occurs in executeUserPromptSubmitHooks function
  • Seems like matcher object doesn't have hooks property initialized
  • PowerShell path detection issue on Windows native environment

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