Tencent/WeKnora · error

failed to create temporary knowledge base: %w

Error message

failed to create temporary knowledge base: %w

What it means

CreateKnowledgeBase for the ephemeral 'tmp-websearch-*' compression KB failed. Without the temp KB the RAG compression pipeline cannot ingest search results and must abort (an existing tempKBID that vanished is already tolerated with a recreate attempt).

Source

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

	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,
			EmbeddingModelID: cfg.EmbeddingModelID,
		}
		createdKB, err = kbSvc.CreateKnowledgeBase(ctx, kb)
		if err != nil {
			return nil, tempKBID, seenURLs, knowledgeIDs, fmt.Errorf(
				"failed to create temporary knowledge base: %w",
				err,
			)
		}
		tempKBID = createdKB.ID
	}

	// Ingest all web results as passages synchronously
	// dedupe by URL across queries within the same temp KB for this request/session
	if seenURLs == nil {
		seenURLs = map[string]bool{}
	}
	for _, r := range webSearchResults {
		sourceURL := r.URL
		title := strings.TrimSpace(r.Title)
		snippet := strings.TrimSpace(r.Snippet)
		body := strings.TrimSpace(r.Content)
		// skip if already ingested for this KB

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check the knowledge base service/DB availability
  2. Verify the embedding model ID resolves to an existing model
  3. Retry compression; the temp KB is recreated on the next attempt
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/application/service/web_search.go:177 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/395b31b21eedd428. Report an issue: GitHub.