Tencent/WeKnora · error

no queries provided

Error message

no queries provided

What it means

KnowledgeSearch.Execute requires at least one query string. When the queries parameter is empty or absent it fails fast with this error before running any retrieval. The ToolResult.Error states plainly that queries is required.

Source

Thrown at internal/agent/tools/knowledge_search.go:225

		return &types.ToolResult{
			Success: false,
			Error:   "no knowledge bases specified and no search targets configured",
		}, fmt.Errorf("no search targets available")
	}

	kbIDs := searchTargets.GetAllKnowledgeBaseIDs()
	logger.Infof(ctx, "[Tool][KnowledgeSearch] Using %d search targets across %d KBs", len(searchTargets), len(kbIDs))

	// Parse query parameter
	queries := input.Queries

	// Validate: query must be provided
	if len(queries) == 0 {
		logger.Errorf(ctx, "[Tool][KnowledgeSearch] No queries provided")
		return &types.ToolResult{
			Success: false,
			Error:   "queries parameter is required",
		}, fmt.Errorf("no queries provided")
	}

	logger.Infof(ctx, "[Tool][KnowledgeSearch] Queries: %v", queries)

	// Search parameters: fall back to global config, then to hardcoded defaults.
	// We used to read tenant.ConversationConfig here as the first source of
	// truth, but that field was removed when the chat pipeline moved to
	// CustomAgent — tenant-level KV settings now live on the agent itself.
	var topK int
	var vectorThreshold, keywordThreshold, minScore float64

	// Fallback to global config if not set
	if topK == 0 && t.config != nil {
		topK = t.config.Conversation.EmbeddingTopK
	}
	if vectorThreshold == 0 && t.config != nil {
		vectorThreshold = t.config.Conversation.VectorThreshold
	}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Provide a non-empty queries array in the tool input
  2. Trim/validate user text before building the queries slice
  3. Confirm the parameter key is exactly 'queries' (naming mismatch silently yields an empty slice)

Example fix

// before
Execute(ctx, map[string]any{"query": q}) // wrong key, queries is empty
// after
Execute(ctx, map[string]any{"queries": []string{q}})
Defensive patterns

Strategy: validation

Validate before calling

queries := toSlice(params["queries"])
if len(queries) == 0 { return errors.New("queries parameter is required") }
for _, q := range queries { if strings.TrimSpace(q) == "" { return errors.New("empty query in list") } }

Type guard

func hasQueries(input map[string]any) bool {
    qs, ok := input["queries"].([]string)
    return ok && len(qs) > 0
}

Try / catch

res, err := tool.Execute(ctx, input)
if err != nil && strings.Contains(err.Error(), "no queries provided") {
    return promptUserForQuery(), nil
}

Prevention

When it happens

Trigger: Invoking knowledge_search with queries missing from input, an empty array, or an array containing only empty strings that the caller filtered out.

Common situations: Agent model omits the queries field in the tool-call JSON; upstream code passes a slice derived from user input that is empty; refactoring changed param name (e.g. query vs queries) so the old key is ignored.

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/1c40c3c7de6a76a4. Report an issue: GitHub.