{"record":{"id":"e9cc88beb008eaed","repo":"Tencent/WeKnora","slug":"failed-to-get-mcp-service-w","errorCode":null,"errorMessage":"failed to get MCP service: %w","messagePattern":"failed to get MCP service: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/mcp_service.go","lineNumber":596,"sourceCode":"\n\ts.mcpManager.CloseClient(id)\n\tlogger.GetLogger(ctx).Infof(\n\t\t\"MCP credential cleared by user: id=%s field=%s, connection closed\",\n\t\tsecutils.SanitizeForLog(id), field,\n\t)\n\treturn nil\n}\n\n// GetMCPServiceResources retrieves the list of resources from an MCP service\nfunc (s *mcpServiceService) GetMCPServiceResources(\n\tctx context.Context,\n\ttenantID uint64,\n\tid string,\n) ([]*types.MCPResource, error) {\n\t// Get service\n\tservice, err := s.mcpServiceRepo.GetByID(ctx, tenantID, id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get MCP service: %w\", err)\n\t}\n\tif service == nil {\n\t\treturn nil, fmt.Errorf(\"MCP service not found\")\n\t}\n\n\t// Get or create client\n\tclient, err := s.mcpManager.GetOrCreateClient(ctx, service)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get MCP client: %w\", err)\n\t}\n\n\t// List resources\n\tresources, err := client.ListResources(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list resources: %w\", err)\n\t}\n\n\treturn resources, nil","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/mcp_service.go#L578-L614","documentation":"Thrown by GetMCPServiceResources when mcpServiceRepo.GetByID fails to load the MCP service before listing its resources. A persistence-layer error (connectivity, timeout); distinct from the not-found case which is handled separately.","triggerScenarios":"Thrown at internal/application/service/mcp_service.go:596 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check database connectivity and retry","Verify tenant ID and service ID scope","Inspect the wrapped repository error for the exact cause"],"exampleFix":null,"handlingStrategy":"retry","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"}