Skip to content

bb plugin list reports handlers: 0 errors while a plugin throws on every call #2286

Open

Description

@MGrin

What we observed

On 2026-08-21 a first-party-style plugin (accounts, a path: plugin) threw on every invocation of one handler for 55.4 hours. Throughout that window:

  • bb plugin list reported the plugin as running
  • its per-plugin counter read handlers: 0 errors
  • the plugin's own log carried 196 throws, all bb.sdk.threads.rateLimitRecovery is not a function, first 2026-08-19T05:37Z, last 2026-08-21T13:02:21Z

So the one number a person would check to answer "is this plugin healthy" read healthy for the entire outage. Nobody noticed until someone read the log file directly.

For contrast, the counter is not always zero — we saw handlers: 24 errors on a different plugin the same day, so the mechanism works for whatever it does count.

What we think the mechanism is — stated as inference, not as a claim about your code

We have not read bb's handler dispatch. From the outside, the observation is consistent with the counter incrementing only on exceptions that escape the handler, while an exception caught inside the handler never reaches it. We could be wrong about the internals; the observation above is what we measured.

This looks adjacent to #2128 (routing uncaught service exceptions to the supervisor) but not the same case — that one is about exceptions escaping to the process, this one is about exceptions that never escape at all.

Why it matters

handlers: N errors is the natural health signal — it is in bb plugin list, it needs no log access, and it is what an operator or an automated check reaches for first. A signal that reads 0 during a total functional outage is worse than no signal, because a check built on it passes and reports healthy.

What would help

Counting handler-caught exceptions as well — or exposing them as a separate figure, if conflating them would be wrong for other consumers — would have surfaced this on the first throw rather than after 55 hours, with no log parsing and no time window.

What we did locally, and its limits

We shipped a log-reading backstop that greps plugin logs for JavaScript TypeError/ReferenceError shapes. Measured 196/196 precision over 27,161 log lines, but it structurally cannot catch three cases:

  • a handler throwing a plain domain Error("sync failed: …") — textually indistinguishable from ~2,000 legitimate timeout/stall lines in the same corpus
  • a handler that fails silently, logging nothing
  • a broken plugin nothing exercises, so it never reaches the throw

All three would be covered by the counter. Happy to provide the log corpus or test against a patch if that is useful.

Version

bb 0.39.0, macOS 26 (Darwin 25.5.0).

Activity

  1. added theissue type on Aug 23, 2026
  2. added
    plugins
    cli
    on Aug 23, 2026
  3. SawyerHood commented on Aug 24, 2026

    @SawyerHood
    Collaborator

    ---Auto-Generated---

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2286.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): handlerStats.errorCount is incremented only inside invokeWrapped (request-shaped surfaces: http/rpc/cli/tools/events/mentions/schedules); background-service crashes and uncaught exceptions go through onServiceSettled/handleUncaughtException which only logger.warn and restart with backoff (status stays running, nothing counted), and bb.log.error from a plugin that catches its own exception is never aggregated at all.
    • Proposed fix: In apps/server/src/services/plugins/plugin-runtime.ts onServiceSettled's post-activation crash branch (which also receives the Route plugin service uncaught exceptions to the service supervisor #2128 uncaught-exception path): statsFor(id).errorCount += 1 and setStatus(id, "running", service ${name} crashed: ${message}) mirroring invokeWrapped; clear the detail after a healthy stretch. In plugin-api.ts emitLog, count level === "error" calls (either into errorCount or a new additive handlerStats.loggedErrorCount in packages/server-contract) and set statusDetail to the latest message. Change apps/cli/src/commands/plugin.ts printPlugin to print the handlers lin…
    • Caveats: The reporter's 'accounts' plugin is private, so which failure path (caught+bb.log.error, uncaught timer throw, or start() crash loop) it hit is unverifiable; all three were reproduced and all three leave errorCount 0 and status running. The CLI does not literally print 'handlers: 0 errors' (the line is suppressed when count is 0 and the errors suffix when errorCount is 0); the reporter most likely…

    The report is self-contained: copy-paste repro steps with the test or script inline, expected vs actual output, screenshots where the bug is visual, and code permalinks at the base commit. It was independently re-executed by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Code

  4. added
    confirmed-repro
    on Aug 24, 2026
  5. added a commit that references this issue on Nov 24, 2026
    64fbe12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliconfirmed-reproplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions