{"record":{"id":"0bad365515b74745","repo":"Tencent/WeKnora","slug":"connection-closed","errorCode":null,"errorMessage":"connection closed","messagePattern":"connection closed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/mcp/errors.go","lineNumber":31,"sourceCode":"\tErrAlreadyConnected = errors.New(\"client already connected\")\n\n\t// ErrInitializeFailed is returned when MCP initialize handshake fails\n\tErrInitializeFailed = errors.New(\"MCP initialize handshake failed\")\n\n\t// ErrToolNotFound is returned when requested tool is not found\n\tErrToolNotFound = errors.New(\"tool not found\")\n\n\t// ErrResourceNotFound is returned when requested resource is not found\n\tErrResourceNotFound = errors.New(\"resource not found\")\n\n\t// ErrInvalidResponse is returned when server response is invalid\n\tErrInvalidResponse = errors.New(\"invalid response from server\")\n\n\t// ErrTimeout is returned when operation times out\n\tErrTimeout = errors.New(\"operation timed out\")\n\n\t// ErrConnectionClosed is returned when connection is closed unexpectedly\n\tErrConnectionClosed = errors.New(\"connection closed\")\n)\n","sourceCodeStart":13,"sourceCodeEnd":33,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/mcp/errors.go#L13-L33","documentation":"Sentinel error signaling that the MCP client's underlying connection was closed (by the server, network drop, or an explicit Close) while an operation was in flight or before it started. It fires whenever an operation is attempted against a client whose transport is no longer alive; callers use it to decide between reconnecting and failing fast.","triggerScenarios":"Thrown at internal/mcp/errors.go:31 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reconnect the client (Connect + Initialize) before retrying the operation","Detect connection loss via disconnect callbacks and trigger automatic reconnection","Check server logs / network for why the connection dropped","Surface a clear user-facing message that the MCP server session ended"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}