Tencent/WeKnora · error

web search config is required for RAG compression

Error message

web search config is required for RAG compression

What it means

Configuration guard at the top of CompressWithRAG: the method needs settings from *types.WebSearchConfig (model selection, parameters) to build the temporary knowledge base for RAG compression, and a nil cfg was passed. It fires when the search/compression pipeline is invoked without a web search configuration.

Source

Thrown at internal/application/service/web_search.go:154

			base.ProxyURL = pu
		}
	}
	return base
}

// CompressWithRAG performs RAG-based compression using a temporary, hidden knowledge base.
// The temporary knowledge base is deleted after use. The UI will not list it due to repo filtering.
func (s *WebSearchService) CompressWithRAG(
	ctx context.Context, sessionID string, tempKBID string, questions []string,
	webSearchResults []*types.WebSearchResult, cfg *types.WebSearchConfig,
	kbSvc interfaces.KnowledgeBaseService, knowSvc interfaces.KnowledgeService,
	seenURLs map[string]bool, knowledgeIDs []string,
) (compressed []*types.WebSearchResult, kbID string, newSeen map[string]bool, newIDs []string, err error) {
	if len(webSearchResults) == 0 || len(questions) == 0 {
		return
	}
	if cfg == nil {
		return nil, tempKBID, seenURLs, knowledgeIDs, fmt.Errorf("web search config is required for RAG compression")
	}
	if cfg.EmbeddingModelID == "" {
		return nil, tempKBID, seenURLs, knowledgeIDs, fmt.Errorf("embedding_model_id is required for RAG compression")
	}
	var createdKB *types.KnowledgeBase
	// reuse or create temp KB
	if strings.TrimSpace(tempKBID) != "" {
		createdKB, err = kbSvc.GetKnowledgeBaseByID(ctx, tempKBID)
		if err != nil {
			logger.Warnf(ctx, "Temp KB %s not available, recreating: %v", tempKBID, err)
			createdKB = nil
		}
	}
	if createdKB == nil {
		kb := &types.KnowledgeBase{
			Name:             fmt.Sprintf("tmp-websearch-%d", time.Now().UnixNano()),
			Description:      "Ephemeral search compression KB",
			IsTemporary:      true,

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Pass the web search config used for the original search into CompressWithRAG
  2. Verify the caller's config was loaded before compression
  3. Fail the compression request and ask the client to configure search
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/application/service/web_search.go:154 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/1eb1422170637258. Report an issue: GitHub.