Tencent/WeKnora · error

cannot choose a knowledge base for new wiki page %s: server

Error message

cannot choose a knowledge base for new wiki page %s: server provenance conflicts across %s

What it means

resolveWikiCreateKB refuses to pick a creation target when multiple distinct server-side provenance owners (KBs that already contain the slug) conflict. Rather than guessing where to create the new page, it fails with the conflicting candidate KB IDs. This guards against silently creating a duplicate page in the wrong KB.

Source

Thrown at internal/agent/tools/wiki_route_resolver.go:199

	allowed := make(map[string]struct{}, len(scopes))
	for _, scope := range scopes {
		allowed[scope.KnowledgeBaseID] = struct{}{}
	}
	candidates := make([]string, 0, len(preferred)+len(serverHints))
	for _, scope := range preferred {
		candidates = append(candidates, scope.KnowledgeBaseID)
	}
	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

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Explicitly specify the target knowledge base for the create operation instead of relying on inference
  2. Clean up duplicate pages sharing the slug across KBs
  3. Invalidate/repair the provenance cache if it lists KBs that no longer contain the slug
  4. Narrow the allowed scopes before the create call so only one candidate KB remains

Example fix

// before
kbID, err := resolveWikiCreateKB(ctx, slug, scopes, routes)
// after: pin the KB explicitly
kbID := args["knowledge_base_id"] // require it when ambiguity is possible
if kbID == "" { kbID, err = resolveWikiCreateKB(ctx, slug, scopes, routes) }
Defensive patterns

Strategy: validation

Validate before calling

owners := provenanceOwnersForSlug(slug, routes) // cached server-side owners
if len(owners) > 1 {
    return errors.New("ambiguous create target: specify knowledge_base_id explicitly")
}
if kbArg == "" { return errors.New("knowledge_base_id is required for create") }

Type guard

null

Try / catch

kbID, err := resolveWikiCreateKB(ctx, slug, scopes, routes)
if err != nil && strings.Contains(err.Error(), "provenance conflicts") {
    // ask the model/user to pick a KB, then retry with that KB pinned
}

Prevention

When it happens

Trigger: Creating a wiki page whose slug already resolves (per cached provenance/server hits) to two or more different KBs, so candidates after dedup has length > 1.

Common situations: Same slug existing in several KBs when the model issues a create call without specifying a KB; stale provenance cache pointing at multiple owners after page moves; overly broad KB scopes.

Related errors


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