Tencent/WeKnora · error

failed to get document info

Error message

failed to get document info: %v

What it means

Per-document authorization failed inside the concurrent worker: authorizeKnowledgeInSearchTargets rejected the knowledge ID (missing, out of KB scope, or outside @mention scope), so that document is recorded with an error in the shared results map while other documents continue processing.

Solutions

  1. Check the knowledge ID exists and is within the Agent scope
  2. Verify the @mention/document scope includes the requested document
  3. Surface per-document errors so partial results remain usable
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/agent/tools/get_document_info.go:165 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/a0ddbbb98b3cc1af. Report an issue: GitHub.

Appendix: source

Thrown at internal/agent/tools/get_document_info.go:165

			}
			mu.Lock()
			results["faq:"+id] = &docInfo{chunk: chunk, faqMeta: meta, chunkCount: 1}
			mu.Unlock()
		}(faqID)
	}

	for _, knowledgeID := range knowledgeIDs {
		wg.Add(1)
		go func(id string) {
			defer wg.Done()

			knowledge, err := authorizeKnowledgeInSearchTargets(
				ctx, t.searchTargets, id, t.knowledgeService,
			)
			if err != nil {
				mu.Lock()
				results[id] = &docInfo{
					err: fmt.Errorf("failed to get document info: %v", err),
				}
				mu.Unlock()
				return
			}

			// Use knowledge's actual tenant_id for chunk query (supports cross-tenant shared KB).
			// Keep chunk-type filter aligned with list_knowledge_chunks so the
			// "chunk_count" reported here matches what that tool can page over.
			_, total, err := t.chunkService.GetRepository().
				ListPagedChunksByKnowledgeID(ctx, knowledge.TenantID, id, &types.Pagination{
					Page:     1,
					PageSize: 1,
				}, []types.ChunkType{types.ChunkTypeText, types.ChunkTypeFAQ}, nil, "", "", "", "", &enabled)
			if err != nil {
				mu.Lock()
				results[id] = &docInfo{
					err: fmt.Errorf("failed to get document info: %v", err),
				}

View on GitHub (pinned to 988cbb0330)