Tencent/WeKnora · error
MCP service not found
Error message
MCP service not found
What it means
Lookup guard in mcpServiceService.ClearMCPCredential: the tenant-scoped repository GetByID returned nil for the requested MCP service ID, meaning no such service exists in this workspace. The method cannot clear a credential on a nonexistent entity, so it aborts before touching AuthConfig; distinct from a repo error, which would surface as 'failed to get MCP service'.
Source
Thrown at internal/application/service/mcp_service.go:546
s.mcpManager.CloseClient(id)
logger.GetLogger(ctx).Infof(
"MCP credentials updated, connection closed: %s (ID: %s)",
secutils.SanitizeForLog(existing.Name), id,
)
return existing, nil
}
// ClearMCPCredential removes a single credential field. Idempotent: clearing
// an already-empty field returns nil without writing or reconnecting.
func (s *mcpServiceService) ClearMCPCredential(
ctx context.Context, tenantID uint64, id, field string,
) error {
existing, err := s.mcpServiceRepo.GetByID(ctx, tenantID, id)
if err != nil {
return fmt.Errorf("failed to get MCP service: %w", err)
}
if existing == nil {
return fmt.Errorf("MCP service not found")
}
if existing.IsBuiltin {
return fmt.Errorf("builtin MCP services cannot have credentials modified")
}
if existing.AuthConfig == nil {
return nil // nothing to clear
}
changed := false
switch field {
case "api_key":
if existing.AuthConfig.APIKey != "" {
existing.AuthConfig.APIKey = ""
changed = true
}
case "token":
if existing.AuthConfig.Token != "" {
existing.AuthConfig.Token = ""View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the MCP service ID and that it belongs to the tenant
- List MCP services to confirm the record still exists
- Return/propagate a 404-style response to the caller
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/application/service/mcp_service.go:546 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/b26eea8acde32091.
Report an issue: GitHub.