Tencent/WeKnora · error

web search provider not found

Error message

web search provider not found

What it means

Lookup guard in UpdateProviderCredentials: the tenant-scoped GetByID for the web search provider ID returned nil, so there is no provider record to write the API key onto. It fires when the ID is wrong or belongs to another workspace; unlike a repo error, this specifically means 'not found' rather than 'lookup failed'.

Source

Thrown at internal/application/service/web_search_provider.go:85

		}
	}

	logger.Infof(ctx, "Updating web search provider: tenant=%d, id=%s", provider.TenantID, provider.ID)
	return s.repo.Update(ctx, provider)
}

// UpdateProviderCredentials writes the api_key credential field. Web search
// providers are stateless from our side — every search call rebuilds a
// transport from current Parameters — so no cache invalidation is required.
func (s *webSearchProviderService) UpdateProviderCredentials(
	ctx context.Context, tenantID uint64, id string, apiKey *string,
) (*types.WebSearchProviderEntity, error) {
	existing, err := s.repo.GetByID(ctx, tenantID, id)
	if err != nil {
		return nil, err
	}
	if existing == nil {
		return nil, fmt.Errorf("web search provider not found")
	}

	if apiKey != nil && *apiKey != "" && *apiKey != existing.Parameters.APIKey {
		existing.Parameters.APIKey = *apiKey
		if err := s.repo.Update(ctx, existing); err != nil {
			return nil, err
		}
		logger.Infof(ctx, "WebSearch provider credentials updated: tenant=%d id=%s", tenantID, id)
	}
	return existing, nil
}

// ClearProviderCredential clears the api_key credential. Idempotent.
func (s *webSearchProviderService) ClearProviderCredential(
	ctx context.Context, tenantID uint64, id, field string,
) error {
	if field != "api_key" {
		return fmt.Errorf("unknown credential field: %s", field)

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify the provider ID and tenant match an existing row
  2. Refresh the client's provider list (entity may have been deleted)
  3. Recreate the provider before setting credentials
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/application/service/web_search_provider.go:85 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/135935e3ddc52cda. Report an issue: GitHub.