{"record":{"id":"6a72aae518b52f96","repo":"Tencent/WeKnora","slug":"client-not-connected","errorCode":null,"errorMessage":"client not connected","messagePattern":"client not connected","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/mcp/errors.go","lineNumber":10,"sourceCode":"package mcp\n\nimport \"errors\"\n\nvar (\n\t// ErrUnsupportedTransport is returned when transport type is not supported\n\tErrUnsupportedTransport = errors.New(\"unsupported transport type\")\n\n\t// ErrNotConnected is returned when operation requires connection but client is not connected\n\tErrNotConnected = errors.New(\"client not connected\")\n\n\t// ErrAlreadyConnected is returned when trying to connect an already connected client\n\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\")","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/mcp/errors.go#L1-L28","documentation":"Generic guard sentinel returned by mcpGoClient methods (Initialize when c.connected is false, ListTools and similar calls when c.initialized is false) whenever an operation is issued before the connection/initialize handshake completed. It signals call-order misuse, not a transport failure.","triggerScenarios":"Thrown at internal/mcp/errors.go:10 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call Connect and then Initialize before any other client operation","Track initialization state in the caller and defer dependent calls until Initialize returns success","If races are possible, serialize access or check connected/initialized state under the client's lock","Reconnect and re-initialize if the connection was dropped previously"],"exampleFix":null,"handlingStrategy":"try-catch","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"}