Tencent/WeKnora · error

slug is required

Error message

slug is required

What it means

resolveUniqueWikiPage validates its slug argument before attempting any per-scope lookups. An empty (or whitespace-only) slug cannot identify a wiki page, so it fails fast with this error instead of issuing doomed GetPageBySlug calls. It is an argument-validation error guarding the resolver's contract.

Source

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

			remaining = append(remaining, scope)
		}
	}
	return remaining
}

// resolveUniqueWikiPage is the shared mutation/issue routing boundary. It
// checks every allowed KB (cached provenance only affects order) and refuses
// ambiguous slugs instead of silently mutating the first KB.
func resolveUniqueWikiPage(
	ctx context.Context,
	service interfaces.WikiPageService,
	slug string,
	kbIDs []string,
	routes *WikiRouteResolver,
) (*types.WikiPage, string, error) {
	slug = strings.TrimSpace(slug)
	if slug == "" {
		return nil, "", fmt.Errorf("slug is required")
	}
	scopes := NewWikiScopesFromKBIDs(kbIDs)
	preferred := routes.scopesForSlug(slug, scopes)
	ordered := append(append([]WikiScope(nil), preferred...), scopesOutsideKBs(scopes, preferred)...)
	type hit struct {
		page *types.WikiPage
		kbID string
	}
	var hits []hit
	for _, scope := range ordered {
		page, err := service.GetPageBySlug(ctx, scope.KnowledgeBaseID, slug)
		if err != nil {
			if errors.Is(err, repository.ErrWikiPageNotFound) {
				continue
			}
			return nil, "", fmt.Errorf(
				"failed to resolve wiki page %s in knowledge base %s: %w",
				slug, scope.KnowledgeBaseID, err,

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Ensure the tool schema marks slug as required so the model always supplies it
  2. Trim/validate the slug in the tool's argument parsing and reject the call early with a clear tool error
  3. Have the caller list pages or search by title when the slug is unknown instead of passing an empty string

Example fix

// before
slug := args["slug"]
page, kbID, err := resolveUniqueWikiPage(ctx, slug, kbIDs, routes)
// after
slug := strings.TrimSpace(args["slug"])
if slug == "" { return &types.ToolResult{Success: false, Error: "slug is required"}, nil }
page, kbID, err := resolveUniqueWikiPage(ctx, slug, kbIDs, routes)
Defensive patterns

Strategy: validation

Validate before calling

slug := strings.TrimSpace(args["slug"])
if slug == "" {
    return &types.ToolResult{Success: false, Error: "slug is required"}, nil
}

Type guard

func validSlug(s string) bool { return strings.TrimSpace(s) != "" }

Try / catch

page, kbID, err := resolveUniqueWikiPage(ctx, slug, kbIDs, routes)
if err != nil && strings.Contains(err.Error(), "slug is required") {
    // prompt model/user for the slug; do not retry with same args
}

Prevention

When it happens

Trigger: Calling resolveUniqueWikiPage (via the wiki tool's Execute, e.g. wiki read/update/delete) with slug "" or a slug consisting only of whitespace, typically because the LLM omitted the slug parameter or upstream parsing produced an empty value.

Common situations: Model calling the wiki tool without filling the slug argument; a page title never converted to a slug upstream; tool schema allowing the field to be omitted.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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