Tencent/WeKnora · error

failed to get MCP service: %w

Error message

failed to get MCP service: %w

What it means

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.

Source

Thrown at internal/application/service/mcp_service.go:596

	s.mcpManager.CloseClient(id)
	logger.GetLogger(ctx).Infof(
		"MCP credential cleared by user: id=%s field=%s, connection closed",
		secutils.SanitizeForLog(id), field,
	)
	return nil
}

// GetMCPServiceResources retrieves the list of resources from an MCP service
func (s *mcpServiceService) GetMCPServiceResources(
	ctx context.Context,
	tenantID uint64,
	id string,
) ([]*types.MCPResource, error) {
	// Get service
	service, err := s.mcpServiceRepo.GetByID(ctx, tenantID, id)
	if err != nil {
		return nil, fmt.Errorf("failed to get MCP service: %w", err)
	}
	if service == nil {
		return nil, fmt.Errorf("MCP service not found")
	}

	// Get or create client
	client, err := s.mcpManager.GetOrCreateClient(ctx, service)
	if err != nil {
		return nil, fmt.Errorf("failed to get MCP client: %w", err)
	}

	// List resources
	resources, err := client.ListResources(ctx)
	if err != nil {
		return nil, fmt.Errorf("failed to list resources: %w", err)
	}

	return resources, nil

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check database connectivity and retry
  2. Verify tenant ID and service ID scope
  3. Inspect the wrapped repository error for the exact cause
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/application/service/mcp_service.go:596 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/e9cc88beb008eaed. Report an issue: GitHub.