{"record":{"id":"a0ddbbb98b3cc1af","repo":"Tencent/WeKnora","slug":"failed-to-get-document-info-v","errorCode":null,"errorMessage":"failed to get document info: %v","messagePattern":"failed to get document info: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/tools/get_document_info.go","lineNumber":165,"sourceCode":"\t\t\t}\n\t\t\tmu.Lock()\n\t\t\tresults[\"faq:\"+id] = &docInfo{chunk: chunk, faqMeta: meta, chunkCount: 1}\n\t\t\tmu.Unlock()\n\t\t}(faqID)\n\t}\n\n\tfor _, knowledgeID := range knowledgeIDs {\n\t\twg.Add(1)\n\t\tgo func(id string) {\n\t\t\tdefer wg.Done()\n\n\t\t\tknowledge, err := authorizeKnowledgeInSearchTargets(\n\t\t\t\tctx, t.searchTargets, id, t.knowledgeService,\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\tmu.Lock()\n\t\t\t\tresults[id] = &docInfo{\n\t\t\t\t\terr: fmt.Errorf(\"failed to get document info: %v\", err),\n\t\t\t\t}\n\t\t\t\tmu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use knowledge's actual tenant_id for chunk query (supports cross-tenant shared KB).\n\t\t\t// Keep chunk-type filter aligned with list_knowledge_chunks so the\n\t\t\t// \"chunk_count\" reported here matches what that tool can page over.\n\t\t\t_, total, err := t.chunkService.GetRepository().\n\t\t\t\tListPagedChunksByKnowledgeID(ctx, knowledge.TenantID, id, &types.Pagination{\n\t\t\t\t\tPage:     1,\n\t\t\t\t\tPageSize: 1,\n\t\t\t\t}, []types.ChunkType{types.ChunkTypeText, types.ChunkTypeFAQ}, nil, \"\", \"\", \"\", \"\", &enabled)\n\t\t\tif err != nil {\n\t\t\t\tmu.Lock()\n\t\t\t\tresults[id] = &docInfo{\n\t\t\t\t\terr: fmt.Errorf(\"failed to get document info: %v\", err),\n\t\t\t\t}","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/agent/tools/get_document_info.go#L147-L183","documentation":"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.","triggerScenarios":"Thrown at internal/agent/tools/get_document_info.go:165 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the knowledge ID exists and is within the Agent scope","Verify the @mention/document scope includes the requested document","Surface per-document errors so partial results remain usable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}