Skip to content

sl_query intermittently fails with ECONNREFUSED to the local ktx-daemon #338

Description

@andreybavt

Summary

sl_query (and other daemon-backed MCP calls) intermittently fail with:

connect ECONNREFUSED 127.0.0.1:

and occasionally fetch failed / connect ECONNREFUSED 127.0.0.1:<port>. The CLI/MCP layer tries to reach the managed ktx-daemon HTTP server and nothing is listening on the expected loopback port.

Impact

Seen across several anonymous installs (multiple distinct ephemeral ports) in usage telemetry. When it happens the tool call fails outright rather than degrading. Unlike the semantic-query rejections, this is a genuine fault: the daemon is not reachable when the tool needs it.

Root cause — needs investigation

Unknown; candidates:

  • daemon not started / not yet ready when the first sl_query fires (readiness race),
  • daemon crashed/exited, leaving a stale/closed port, or
  • a port/handshake mismatch between the CLI and the managed daemon.

Ask

Add readiness/lifecycle instrumentation to distinguish "never started" vs "crashed" vs "race", and make sl_query ensure/await a healthy daemon (or retry once against a freshly resolved port) before failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clipackages/clibugSomething isn't workingneeds-triageNeeds maintainer review before work begins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions