Skip to content

fix: unhandled promise rejection in GeminiAgent bootstrap (ELECTRON-5B) #1768

@kaizhou-lab

Description

@kaizhou-lab

Problem

When GeminiAgent.initialize() rejects (e.g. missing Google OAuth credentials), the bootstrap promise stored in this.bootstrap has no immediate rejection handler. This causes an unhandledRejection event that propagates from the worker to the renderer, resulting in Sentry error ELECTRON-5B (76 occurrences, still active on v1.9.1).

Sentry issue: ELECTRON-5B

Root Cause

Both GeminiAgent and GeminiAgentManager store a deferred bootstrap promise in their constructors without attaching a rejection handler. The error is only caught when send() / sendMessage() later awaits the promise, but by then Node.js has already flagged it as unhandled.

Fix

Attach a no-op .catch(() => {}) to the bootstrap promise in both constructors. This marks the rejection as "handled" for Node.js while still propagating the error when callers await the promise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions