{"record":{"id":"b161ba54e036756f","repo":"Tencent/WeKnora","slug":"knowledge-service-is-unavailable-for-tag-scoped-gr","errorCode":null,"errorMessage":"knowledge service is unavailable for tag-scoped graph filtering","messagePattern":"knowledge service is unavailable for tag-scoped graph filtering","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/tools/scope_authorization.go","lineNumber":279,"sourceCode":"\tremainingIDs := make([]string, 0, len(results))\n\tfor _, result := range results {\n\t\tif result == nil || result.KnowledgeID == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif result.KnowledgeBaseID != \"\" && result.KnowledgeBaseID != kbID {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"graph result document %s belongs to knowledge base %s, expected %s\",\n\t\t\t\tresult.KnowledgeID, result.KnowledgeBaseID, kbID,\n\t\t\t)\n\t\t}\n\t\tif _, ok := explicitSet[result.KnowledgeID]; !ok {\n\t\t\tremainingIDs = append(remainingIDs, result.KnowledgeID)\n\t\t}\n\t}\n\tvar tagMatches map[string]bool\n\tif len(tagIDs) > 0 {\n\t\tif knowledgeService == nil {\n\t\t\treturn nil, fmt.Errorf(\"knowledge service is unavailable for tag-scoped graph filtering\")\n\t\t}\n\t\tvar err error\n\t\ttagMatches, err = knowledgeIDsMatchingAnyTag(\n\t\t\tctx, remainingIDs, tagIDs, knowledgeService.GetKnowledgeTags,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to validate graph result scope: %w\", err)\n\t\t}\n\t}\n\n\tfiltered := make([]*types.SearchResult, 0, len(results))\n\tfor _, result := range results {\n\t\tif result == nil || result.KnowledgeID == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\t_, explicit := explicitSet[result.KnowledgeID]\n\t\tif explicit || tagMatches[result.KnowledgeID] {\n\t\t\tfiltered = append(filtered, result)","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/agent/tools/scope_authorization.go#L261-L297","documentation":"Dependency guard during tag-scoped graph filtering: the request scope includes tag-scoped targets, which require tag resolution via the knowledge service, but that service handle is nil, so tag-based filtering cannot proceed and fails fast.","triggerScenarios":"Thrown at internal/agent/tools/scope_authorization.go:279 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the knowledge service is wired into the filter call path","Avoid tag-scoped targets when the service is unavailable","Fall back to explicit-ID-only filtering when tags cannot be resolved"],"exampleFix":null,"handlingStrategy":"type-guard","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"}