[BUG] Persistent console errors and EventEmitter memory leak on Desktop launch

Open 💬 4 comments Opened Jun 11, 2026 by layer07

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The Claude Desktop app fires three persistent console errors on every launch. These have been present across multiple app versions over an extended period. The app functions normally despite the errors, but one of them is a real memory leak that compounds over time.

Errors

1. 404 on sessions/watch (fires repeatedly)

GET https://claude.ai/v1/code/sessions/watch 404 (Not Found)

2. 401 on code/repos (fires repeatedly, user is fully authenticated)

GET https://claude.ai/api/organizations/{org_id}/code/repos?skip_status=true 401 (Unauthorized)

This fires despite being authenticated on a Max 20X plan with full Claude Code access.

3. MaxListenersExceededWarning — EventEmitter memory leak

MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
11 $eipc_message$..._AutoUpdater_$_updaterState_$store$_update listeners added.

Also fires for preferencesChanged listeners. The root cause: IPC event listeners for updaterState and preferencesChanged (registered in onStateChange and onPreferencesChanged in mainView.js) are added on every React re-render without cleanup. This is a missing return function in the useEffect that registers them — each render calls addListener without ever calling removeListener on the previous one.

The failed 404/401 requests likely contribute to this by triggering React Query retries → re-renders → more leaked listeners.

Expected Behavior

  • Sessions endpoint should return 200 or not be polled if inactive for the user
  • Authenticated users should not get 401 on org endpoints
  • IPC listeners should be cleaned up on unmount (useEffect should return a cleanup function)

Steps to Reproduce

  1. Open Claude Desktop on Windows
  2. Open DevTools (Ctrl+Shift+I)
  3. Observe console
  4. Errors fire immediately on launch, every launch, indefinitely

Claude Code Version

Claude Desktop 1.12603.1.0 (Microsoft Store, x64)

Platform

Windows

Impact

Low — app works. But the memory leak is real (listener count grows unbounded) and the console noise makes it impossible to debug actual issues when they occur.a

<img width="785" height="574" alt="Image" src="https://github.com/user-attachments/assets/f099d496-6dc2-4580-8cd0-0a75f14914d1" />

What Should Happen?

  • The sessions/watch endpoint should return 200 or the app should not poll it if the feature is not active for the user
  • Authenticated Max plan users should not receive 401 on organization endpoints
  • IPC event listeners registered via onStateChange and onPreferencesChanged in mainView.js should be cleaned up on component unmount (useEffect should return a cleanup function that calls removeListener)
  • The console should be clean on launch so developers can use it to debug actual issues

Error Messages/Logs

GET https://claude.ai/v1/code/sessions/watch 404 (Not Found)

GET https://claude.ai/api/organizations/e86329b8-XXXX-XXXX-XXXX-XXXXXXXXXXXX/code/repos?skip_status=true 401 (Unauthorized)

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 $eipc_message$_7ede4df0-322b-40cf-aa86-e1c50234a429_$_claude.web_$_AutoUpdater_$_updaterState_$store$_update listeners added. Use emitter.setMaxListeners() to increase limit
    at _addListener (VM4 sandbox_bundle:2:36239)
    at IpcRenderer.addListener (VM4 sandbox_bundle:2:39125)
    at Object.onStateChange (mainView.js:1:95598)

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 $eipc_message$_7ede4df0-322b-40cf-aa86-e1c50234a429_$_claude.settings_$_AppPreferences_$_preferencesChanged listeners added.
    at _addListener (VM4 sandbox_bundle:2:36239)
    at IpcRenderer.addListener (VM4 sandbox_bundle:2:39125)
    at Object.onPreferencesChanged (mainView.js:1:12838)

Steps to Reproduce

  1. Open Claude Desktop on Windows
  2. Open DevTools (Ctrl+Shift+I)
  3. Observe console immediately
  4. All three errors fire on launch without any user interaction
  5. Errors persist indefinitely and repeat throughout the session
  6. Close and reopen the app — same errors, every time

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Claude Code Desktop

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

The memory leak fix is trivial. Wherever mainView.js registers IPC listeners
inside a React component, the useEffect needs a cleanup return:

useEffect(() => {
const handler = (data) => { / ... / };
ipcRenderer.addListener('updaterState', handler);
return () => ipcRenderer.removeListener('updaterState', handler);
}, []);

Same pattern for preferencesChanged. This is day-one React.
The current code calls addListener on every render and never calls
removeListener, so listener count grows unbounded for the lifetime
of the app.

The 404 and 401 are simpler: either gate the polling behind a feature
flag check so it doesn't fire when the endpoint isn't available for the
user, or fix the auth token refresh so authenticated Max users don't
get 401s on their own org endpoints. A simple if (!hasCodeAccess) return
before the fetch would eliminate both the console noise and the
re-render cascade that feeds the memory leak.

These errors have been present across multiple major versions over years.
They are trivially reproducible by opening DevTools on any Windows install.
Every Max subscriber sees this on every launch.

If the team needs help writing the fix, I'd suggest asking Claude —
I hear it writes most of the code at Anthropic anyway.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗