Skip to content

Windows 11 Error: Worker service failed to start on port 37777. (port 37777) #380

Description

@AnemoneIndicum

⚡ Quick Bug Report (Recommended)

I updated the plugin to version 7.3.9 today, but when I started Claude Code for the first time after the update, I encountered the error: "Error: Worker service failed to start on port 37777. (port 37777)". I've mentioned this issue in previous issues as well. Previously, the service corresponding to port 37777 would run after Claude Code started, although it would be inaccessible intermittently during Claude programming. Unfortunately, after today's update, it won't start, even after using npm run worker:restart and npm run worker:start. I hope the author can fix this issue soon, resolving this annoying problem for such a great project.
#363
#361

Environment

  • Claude-mem version: 7.3.9
  • Claude Code version: 2.0.61
  • OS: Windows
  • Platform:

Logs

Worker logs are located at:

  • Path: ~/.claude-mem/logs/worker-YYYY-MM-DD.log
  • Example: ~/.claude-mem/logs/worker-2025-12-14.log

Please paste relevant log entries (last 50 lines or error messages):

  /model to try Opus 4.5
  ⎿  SessionStart:Callback hook succeeded: Success
  ⎿  SessionStart:startup says: Plugin hook "node
     "C:\Users\BAIJU\.claude\plugins\marketplaces\thedotmack\plugin/scripts/user-message-hook.js"" failed to start: The
     operation was aborted. Check that the command exists and is executable.
  ⎿  SessionStart:Callback hook succeeded: Success
  ⎿ SessionStart:startup says: Plugin hook error: [2025-12-18 11:36:12.677] [ERROR] [SYSTEM] Failed to start worker
    {platform=win32, port=37777, error=Worker failed to start on Windows (readiness check timed out after 20000ms)

    Troubleshooting:
    1. Check Task Manager for zombie 'bun.exe' or 'node.exe' processes
    2. Verify port 37777 is not in use: netstat -ano | findstr 37777
    3. Check worker logs in ~/.claude-mem/logs/
    4. See GitHub issues: #363, #367, #371, #373
    5. Docs: https://docs.claude-mem.ai/troubleshooting/windows-issues,
    marketplaceRoot=C:\Users\BAIJU\.claude\plugins\marketplaces\thedotmack}
    file:///C:/Users/BAIJU/.claude/plugins/marketplaces/thedotmack/plugin/scripts/context-hook.js:30
    ${u}`),u}var V=M.join(Mt(),".claude","plugins","marketplaces","thedotmack"),B=L(T.HEALTH_CHECK),h=null;function
    E(){if(h!==null)return h;try{let n=M.join(p.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),t=p.loadFromFile(n);return
    h=parseInt(t.CLAUDE_MEM_WORKER_PORT,10),h}catch(n){return c.debug("SYSTEM","Failed to load port from settings, using
     default",{error:n}),h=parseInt(p.get("CLAUDE_MEM_WORKER_PORT"),10),h}}async function I(){try{let n=E();return(await
     fetch(`http://127.0.0.1:${n}/api/readiness`,{signal:AbortSignal.timeout(B)})).ok}catch(n){return
    c.debug("SYSTEM","Worker readiness check failed",{error:n instanceof
    Error?n.message:String(n),errorType:n?.constructor?.name}),!1}}function Pt(){try{let
    n=M.join(V,"package.json");return JSON.parse(Lt(n,"utf-8")).version}catch(n){return c.debug("SYSTEM","Failed to read
     plugin version",{error:n instanceof Error?n.message:String(n)}),null}}async function kt(){try{let n=E(),t=await
    fetch(`http://127.0.0.1:${n}/api/version`,{signal:AbortSignal.timeout(B)});return t.ok?(await
    t.json()).version:null}catch(n){return c.debug("SYSTEM","Failed to get worker version",{error:n instanceof
    Error?n.message:String(n)}),null}}async function K(){let n=Pt(),t=await kt();!n||!t||n!==t&&(c.info("SYSTEM","Worker
     version mismatch detected - restarting worker",{pluginVersion:n,workerVersion:t}),await new
    Promise(e=>setTimeout(e,L(T.PRE_RESTART_SETTLE_DELAY))),await A.restart(E()),await new
    Promise(e=>setTimeout(e,1e3)),await I()||c.error("SYSTEM","Worker failed to restart after version
    mismatch",{expectedVersion:n,runningVersion:t,port:E()}))}async function bt(){let
    n=p.get("CLAUDE_MEM_DATA_DIR"),t=M.join(n,".pm2-migrated");if(Rt(n,{recursive:!0}),!wt(t))try{Dt("pm2",["delete","cl
    aude-mem-worker"],{stdio:"ignore"}),j(t,new Date().toISOString(),"utf-8"),c.debug("SYSTEM","PM2 cleanup completed
    and marked")}catch{j(t,new Date().toISOString(),"utf-8")}let e=E(),r=await A.start(e);return
    r.success||c.error("SYSTEM","Failed to start
    worker",{platform:process.platform,port:e,error:r.error,marketplaceRoot:V}),r.success}async function G(){if(await
    I()){await K();return}if(!await bt()){let e=E();throw new Error(_({port:e,customPrefix:`Worker service failed to
    start on port ${e}.`}))}for(let e=0;e<5;e++)if(await new Promise(r=>setTimeout(r,500)),await I()){await
    K();return}let t=E();throw c.error("SYSTEM","Worker started but not responding to health checks"),new
    Error(_({port:t,customPrefix:`Worker service started but is not responding on port ${t}.`}))}function Y(n){throw
    n.cause?.code==="ECONNREFUSED"||n.code==="ConnectionRefused"||n.name==="TimeoutError"||n.message?.includes("fetch
    failed")||n.message?.includes("Unable to connect")?new Error(_()):n}function X(n,t,e){c.error("HOOK",`${e.operation}
     failed`,{status:n.status,...e},t);let r=e.toolName?`Failed ${e.operation} for ${e.toolName}:
    ${_()}`:`${e.operation} failed: ${_()}`;throw new Error(r)}import It from"path";function
    J(n){if(!n||n.trim()==="")return c.warn("PROJECT_NAME","Empty cwd provided, using
    fallback",{cwd:n}),"unknown-project";let
    t=It.basename(n);if(t==="")if(process.platform==="win32"&&n.match(/^[A-Z]:\\/i)){let
    o=`drive-${n[0].toUpperCase()}`;return c.info("PROJECT_NAME","Drive root detected",{cwd:n,projectName:o}),o}else
    return c.warn("PROJECT_NAME","Root directory detected, using fallback",{cwd:n}),"unknown-project";return t}async
    function q(n){await G();let t=n?.cwd??process.cwd(),e=J(t),r=E(),o=`http://127.0.0.1:${r}/api/context/inject?project
    =${encodeURIComponent(e)}`;try{let s=await fetch(o,{signal:AbortSignal.timeout(T.DEFAULT)});if(!s.ok){let a=await
    s.text();X(s,a,{hookName:"context",operation:"Context generation",project:e,port:r})}return(await
    s.text()).trim()}catch(s){Y(s)}}var yt=process.argv.includes("--colors");if(y.isTTY||yt)q(void
    0).then(n=>{console.log(n),process.exit(0)});else{let n="";y.on("data",t=>n+=t),y.on("end",async()=>{let
    t=n.trim()?JSON.parse(n):void 0,e=await q(t);console.log(JSON.stringify({hookSpecificOutput:{hookEventName:"SessionS
    tart",additionalContext:e}})),process.exit(0)})}

    Error: Worker service failed to start on port 37777. (port 37777)

    To restart the worker:
    1. Exit Claude Code completely
    2. Open Command Prompt or PowerShell
    3. Navigate to: %USERPROFILE%\.claude\plugins\marketplaces\thedotmack
    4. Run: npm run worker:restart
    5. Restart Claude Code
        at G (file:///C:/Users/BAIJU/.claude/plugins/marketplaces/thedotmack/plugin/scripts/context-hook.js:30:2154)
        at async q
    (file:///C:/Users/BAIJU/.claude/plugins/marketplaces/thedotmack/plugin/scripts/context-hook.js:30:3393)
        at async Socket.<anonymous>
    (file:///C:/Users/BAIJU/.claude/plugins/marketplaces/thedotmack/plugin/scripts/context-hook.js:30:3941)

    Node.js v22.15.0

Additional Context

Any other context about the problem.

Metadata

Metadata

Labels

bugConfirmed bug

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions