Tencent/WeKnora · error

failed to get knowledge base: %v

Error message

failed to get knowledge base: %v

What it means

Graph query worker failed to load the knowledge base record by ID: GetKnowledgeBaseByIDOnly returned an error (storage failure or unknown ID), so graph configuration cannot be inspected and this KB's sub-query is recorded as failed without cancelling the other concurrent KB lookups.

Source

Thrown at internal/agent/tools/query_knowledge_graph.go:171

	var wg sync.WaitGroup
	var mu sync.Mutex
	kbResults := make(map[string]*graphQueryResult)

	searchParams := types.SearchParams{
		QueryText:  query,
		MatchCount: 10,
	}

	for _, kbID := range input.KnowledgeBaseIDs {
		wg.Add(1)
		go func(id string) {
			defer wg.Done()

			// Get knowledge base to check graph configuration
			kb, err := t.knowledgeService.GetKnowledgeBaseByIDOnly(ctx, id)
			if err != nil {
				mu.Lock()
				kbResults[id] = &graphQueryResult{kbID: id, err: fmt.Errorf("failed to get knowledge base: %v", err)}
				mu.Unlock()
				return
			}

			// Check if graph extraction is enabled
			if kb.ExtractConfig == nil || (len(kb.ExtractConfig.Nodes) == 0 && len(kb.ExtractConfig.Relations) == 0) {
				mu.Lock()
				kbResults[id] = &graphQueryResult{kbID: id, err: fmt.Errorf("graph extraction not configured")}
				mu.Unlock()
				return
			}

			// Query graph
			results, err := t.knowledgeService.HybridSearch(ctx, id, searchParams)
			if err != nil {
				mu.Lock()
				kbResults[id] = &graphQueryResult{kbID: id, kb: kb, err: fmt.Errorf("query failed: %v", err)}
				mu.Unlock()

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify the knowledge_base_id is valid and exists
  2. Check knowledge service/storage connectivity
  3. Aggregate per-KB errors so one bad ID does not fail the entire graph query
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/agent/tools/query_knowledge_graph.go:171 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/e14537719474ac46. Report an issue: GitHub.