Tencent/WeKnora · error

all document retrievals failed

Error message

all document retrievals failed

What it means

GetDocumentInfo aggregates document info lookups for multiple requested documents. If every single retrieval fails (successDocs is empty), the tool returns a failed ToolResult and this error. It is an aggregate-failure signal: at least one underlying doc lookup errored for all requested IDs.

Source

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

			continue
		}
		result := results["faq:"+faqID]
		if result == nil {
			errors = append(errors, fmt.Sprintf("faq:%s: not found", faqID))
			continue
		}
		if result.err != nil {
			errors = append(errors, fmt.Sprintf("faq:%s: %v", faqID, result.err))
		} else if result.chunk != nil {
			successDocs = append(successDocs, result)
		}
	}

	if len(successDocs) == 0 {
		return &types.ToolResult{
			Success: false,
			Error:   fmt.Sprintf("Failed to retrieve any document info. Errors: %v", errors),
		}, fmt.Errorf("all document retrievals failed")
	}

	output := "=== Document Info ===\n\n"
	output += fmt.Sprintf("Successfully retrieved %d / %d entries\n\n", len(successDocs), requested)

	if len(errors) > 0 {
		output += "=== Partial Failures ===\n"
		for _, errMsg := range errors {
			output += fmt.Sprintf("  - %s\n", errMsg)
		}
		output += "\n"
	}

	formattedDocs := make([]map[string]interface{}, 0, len(successDocs))
	for i, doc := range successDocs {
		output += fmt.Sprintf("[Entry #%d]\n", i+1)

		if doc.chunk != nil {

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Inspect the ToolResult.Error string (it embeds the per-document errors map) to see the underlying cause for each ID
  2. Verify the document IDs exist via a list/search tool before calling get_document_info
  3. Check document-service connectivity and configuration
  4. Retry with a subset of IDs to isolate whether it is one bad ID or a service-wide issue

Example fix

// before
result, _ := getDocInfo.Execute(ctx, map[string]any{"document_ids": []string{"doc-old-1","doc-old-2"}})
// after
listed := searchTool.FindDocuments(ctx, "invoice") // confirm current IDs first
result, _ := getDocInfo.Execute(ctx, map[string]any{"document_ids": listed[:2]})
Defensive patterns

Strategy: validation

Validate before calling

for _, id := range docIDs {
    if strings.TrimSpace(id) == "" { return fmt.Errorf("empty document id in request") }
}
if len(docIDs) == 0 { return errors.New("at least one document id required") }

Type guard

func validDocIDs(ids []string) bool {
    for _, id := range ids { if strings.TrimSpace(id) == "" { return false } }
    return len(ids) > 0
}

Try / catch

res, err := tool.Execute(ctx, input)
if err != nil {
    if strings.Contains(err.Error(), "all document retrievals failed") {
        log.Printf("per-doc errors: %s", res.Error) // embedded per-ID failures
        return fallbackLookup(ctx, docIDs)
    }
    return err
}

Prevention

When it happens

Trigger: Calling the get_document_info tool where every requested document ID fails lookup — e.g. IDs not present in the document service, service outage, or permission denial for all documents.

Common situations: Agent passes stale/renamed document IDs; document store unavailable or misconfigured; tenant/permission scoping excludes all requested docs.

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/89b5d7bb8b180a28. Report an issue: GitHub.