GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Plugin Hanging When Using client.app.log() During Initialization · Issue #7741 · anomalyco/opencode

Plugin Hanging When Using client.app.log() During Initialization #7741

New issue
Copy link
New issue
Copy link
Closed
#11642
Closed
Plugin Hanging When Using client.app.log() During Initialization#7741
#11642
Copy link
Assignees
thdxr
Labels
bugSomething isn't working

Description

@davidbernat
davidbernat
opened on Jan 11, 2026
Issue body actions

Description

What proper implementations and/or workarounds do you suggest without busying the simplest code?

Issue Summary

OpenCode plugins hang indefinitely when calling client.app.log() during plugin initialization, preventing OpenCode from starting properly.

Environment

  • OpenCode version: Latest (as of Jan 2025)
  • Plugin API: @opencode-ai/[email protected]
  • Platform: macOS (Darwin)

Reproduction Steps

  1. Create a plugin that calls client.app.log() during initialization
  2. Place plugin in .opencode/plugin/ directory
  3. Start OpenCode
  4. OpenCode hangs immediately after "loading plugin" message

Expected Behavior

Plugin should load successfully and logging calls should work without hanging.

Actual Behavior

OpenCode hangs indefinitely during plugin initialization at the first client.app.log() call.

Code to Reproduce

import type { Plugin } from "@opencode-ai/plugin"

export const TestPlugin: Plugin = async ({ client, directory }) => {
  // This call causes hang
  await client.app.log({
    service: "test-plugin",
    level: "info", 
    message: "Plugin initialized"
  })

  return {}
}

Root Cause Analysis

The issue appears to be infinite recursion in the logging system during plugin initialization:

  1. Plugin loads → calls client.app.log()
  2. Logging system not fully initialized → triggers internal events
  3. Plugin system intercepts these events → tries to process them
  4. Plugin initialization continues → tries to log again
  5. Creates circular dependency → infinite loop/hang

Evidence

  • Plugin appears in logs as "loading plugin"
  • No subsequent log entries appear
  • Process hangs at first logging call
  • Complex extra objects may exacerbate serialization issues
  • Deferring logging with setTimeout() resolves the issue

Workarounds

  1. Delay logging: Use setTimeout(() => { /* log calls */ }, 500)
  2. Wrap in try-catch: Add error handling around all log calls
  3. Console logging: Use console.log() for initialization debugging

Impact

  • High: Prevents plugins from using the logging API properly
  • Blocks development of robust plugins
  • Forces plugin developers to use workarounds

Potential Fixes

The logging system should either:

  1. Queue logs during initialization: Buffer log calls until the system is ready
  2. Block event processing: Prevent plugin system from processing logs during initialization
  3. Add initialization lifecycle: Provide onPluginReady or similar hook
  4. Fix recursion detection: Detect and prevent infinite logging loops

Additional Observations

  • Issue occurs even with simple logging (minimal payload)
  • Problem is specific to plugin initialization phase
  • Regular logging after initialization works fine
  • Multiple users reporting similar issues (community feedback)
Reacted by Ian Pascoe, Tyler Marshall and Antonio H L Santos

Activity

  1. davidbernat
    added
    bugSomething isn't working
    on Jan 11, 2026
  2. github-actions
    assigned
    thdxr
    on Jan 11, 2026
  3. github-actions commented on Jan 11, 2026

    @github-actions
    github-actionsBot
    on Jan 11, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • [BUG]: client.app is undefined when passed to plugins, causing crashes in plugin logging #5793: [BUG]: client.app is undefined when passed to plugins, causing crashes in plugin logging
    • client.session.summarize hangs forever in Plugin #5449: client.session.summarize hangs forever in Plugin
    • Logs sent via client.app.log() are not visible with --print-logs #7301: Logs sent via client.app.log() are not visible with --print-logs

    Feel free to ignore if none of these address your specific case.

  4. ian-pascoe commented on Jan 20, 2026

    @ian-pascoe
    ian-pascoe
    on Jan 20, 2026
    More actions

    +1

  5. Tigatok commented on Jan 30, 2026

    @Tigatok
    Tigatok
    on Jan 30, 2026
    More actions

    +1, the official docs have this as an example

  6. rekram1-node
    closed this as completedin #11642on Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.