Tencent/WeKnora · error
cannot choose a knowledge base for new wiki page
Error message
cannot choose a knowledge base for new wiki page %s from %d allowed scopes
What it means
When there are no conflicting provenance owners but more than one (or zero) allowed KB scopes, resolveWikiCreateKB cannot infer a unique creation target and fails with this error naming the scope count. It is the resolver's 'the model must tell me which KB to create in' error.
Solutions
- Have the tool require/ask for the target knowledge_base_id when more than one KB is in scope
- Restrict the agent's wiki scopes to a single KB if all writes target one space
- Create the page first in a pinned KB and reuse its provenance for follow-ups
- Surface the scope count to the model so it can disambiguate on the next turn
Example fix
// tool argument handling
kbArg, _ := args["knowledge_base_id"].(string)
if kbArg == "" && len(scopes) != 1 {
return &types.ToolResult{Success: false, Error: fmt.Sprintf("specify a knowledge base (%d allowed)", len(scopes))}, nil
}
kbID, err := resolveWikiCreateKB(ctx, slug, scopes, routes) Defensive patterns
Strategy: validation
Validate before calling
kbArg, _ := args["knowledge_base_id"].(string)
if kbArg == "" && len(allowedScopes) != 1 {
return &types.ToolResult{Success: false,
Error: fmt.Sprintf("specify one of %d allowed knowledge bases for creation", len(allowedScopes))}, nil
} Type guard
null
Try / catch
kbID, err := resolveWikiCreateKB(ctx, slug, scopes, routes)
if err != nil && strings.Contains(err.Error(), "allowed scopes") {
// re-prompt with the scope list so the model can choose a KB
} Prevention
- Make knowledge_base_id a required create parameter when the session has multiple KBs
- Restrict agent write scopes to one KB where workflows allow
- Emit the allowed KB list in tool descriptions so the model self-disambiguates
- Test create flows with 0, 1, and N scopes
When it happens
Trigger: Create call with a novel slug (no server provenance) while the request allows len(scopes) != 1 knowledge bases — e.g. 0 or 2+ KBs in scope.
Common situations: Agent session authorized across several KBs and the model omitted the target KB; slug never used before so there is no cached owner; scopes misconfigured to include extra KBs.
Related errors
- cannot choose a knowledge base for new wiki page
- slug is required
- : slug belongs to
- API key is required for Exa provider
- cannot request upgrade to same or lower role
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/7300f675f3fc5e81.
Report an issue: GitHub.
Appendix: source
Thrown at internal/agent/tools/wiki_route_resolver.go:207
for _, kbID := range serverHints {
if _, ok := allowed[kbID]; ok {
candidates = append(candidates, kbID)
}
}
candidates = dedupNonEmptyStrings(candidates)
if len(candidates) == 1 {
return candidates[0], nil
}
if len(candidates) > 1 {
return "", fmt.Errorf(
"cannot choose a knowledge base for new wiki page %s: server provenance conflicts across %s",
slug, strings.Join(candidates, ", "),
)
}
if len(scopes) == 1 {
return scopes[0].KnowledgeBaseID, nil
}
return "", fmt.Errorf("cannot choose a knowledge base for new wiki page %s from %d allowed scopes", slug, len(scopes))
}
func wikiKnowledgeBasesForSourceRefs(
ctx context.Context,
refs []string,
knowledgeService interfaces.KnowledgeService,
allowedKBIDs []string,
) ([]string, error) {
if len(refs) == 0 {
return nil, nil
}
if knowledgeService == nil {
return nil, fmt.Errorf("knowledge service is unavailable")
}
allowed := make(map[string]struct{}, len(allowedKBIDs))
for _, kbID := range dedupNonEmptyStrings(allowedKBIDs) {
allowed[kbID] = struct{}{}
}View on GitHub (pinned to 988cbb0330)