Tencent/WeKnora · error
client already connected
Error message
client already connected
What it means
Sentinel returned by mcpGoClient.Connect when c.connected is already true, i.e. Connect was called twice on the same client without an intervening Close. It is a pure state guard against duplicate connection establishment.
Source
Thrown at internal/mcp/errors.go:13
package mcp
import "errors"
var (
// ErrUnsupportedTransport is returned when transport type is not supported
ErrUnsupportedTransport = errors.New("unsupported transport type")
// ErrNotConnected is returned when operation requires connection but client is not connected
ErrNotConnected = errors.New("client not connected")
// ErrAlreadyConnected is returned when trying to connect an already connected client
ErrAlreadyConnected = errors.New("client already connected")
// ErrInitializeFailed is returned when MCP initialize handshake fails
ErrInitializeFailed = errors.New("MCP initialize handshake failed")
// ErrToolNotFound is returned when requested tool is not found
ErrToolNotFound = errors.New("tool not found")
// ErrResourceNotFound is returned when requested resource is not found
ErrResourceNotFound = errors.New("resource not found")
// ErrInvalidResponse is returned when server response is invalid
ErrInvalidResponse = errors.New("invalid response from server")
// ErrTimeout is returned when operation times out
ErrTimeout = errors.New("operation timed out")
// ErrConnectionClosed is returned when connection is closed unexpectedly
ErrConnectionClosed = errors.New("connection closed")View on GitHub (pinned to 988cbb0330)
Solutions
- Guard Connect calls with the client's connected state or a sync.Once
- Close the existing connection before reconnecting
- Treat this error as benign and reuse the existing connection instead of reconnecting
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/mcp/errors.go:13 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/6b0005ed04aa2bef.
Report an issue: GitHub.