{"record":{"id":"1c40c3c7de6a76a4","repo":"Tencent/WeKnora","slug":"no-queries-provided","errorCode":null,"errorMessage":"no queries provided","messagePattern":"no queries provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/tools/knowledge_search.go","lineNumber":225,"sourceCode":"\t\treturn &types.ToolResult{\n\t\t\tSuccess: false,\n\t\t\tError:   \"no knowledge bases specified and no search targets configured\",\n\t\t}, fmt.Errorf(\"no search targets available\")\n\t}\n\n\tkbIDs := searchTargets.GetAllKnowledgeBaseIDs()\n\tlogger.Infof(ctx, \"[Tool][KnowledgeSearch] Using %d search targets across %d KBs\", len(searchTargets), len(kbIDs))\n\n\t// Parse query parameter\n\tqueries := input.Queries\n\n\t// Validate: query must be provided\n\tif len(queries) == 0 {\n\t\tlogger.Errorf(ctx, \"[Tool][KnowledgeSearch] No queries provided\")\n\t\treturn &types.ToolResult{\n\t\t\tSuccess: false,\n\t\t\tError:   \"queries parameter is required\",\n\t\t}, fmt.Errorf(\"no queries provided\")\n\t}\n\n\tlogger.Infof(ctx, \"[Tool][KnowledgeSearch] Queries: %v\", queries)\n\n\t// Search parameters: fall back to global config, then to hardcoded defaults.\n\t// We used to read tenant.ConversationConfig here as the first source of\n\t// truth, but that field was removed when the chat pipeline moved to\n\t// CustomAgent — tenant-level KV settings now live on the agent itself.\n\tvar topK int\n\tvar vectorThreshold, keywordThreshold, minScore float64\n\n\t// Fallback to global config if not set\n\tif topK == 0 && t.config != nil {\n\t\ttopK = t.config.Conversation.EmbeddingTopK\n\t}\n\tif vectorThreshold == 0 && t.config != nil {\n\t\tvectorThreshold = t.config.Conversation.VectorThreshold\n\t}","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/agent/tools/knowledge_search.go#L207-L243","documentation":"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.","triggerScenarios":"Invoking knowledge_search with queries missing from input, an empty array, or an array containing only empty strings that the caller filtered out.","commonSituations":"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.","solutions":["Provide a non-empty queries array in the tool input","Trim/validate user text before building the queries slice","Confirm the parameter key is exactly 'queries' (naming mismatch silently yields an empty slice)"],"exampleFix":"// before\nExecute(ctx, map[string]any{\"query\": q}) // wrong key, queries is empty\n// after\nExecute(ctx, map[string]any{\"queries\": []string{q}})","handlingStrategy":"validation","validationCode":"queries := toSlice(params[\"queries\"])\nif len(queries) == 0 { return errors.New(\"queries parameter is required\") }\nfor _, q := range queries { if strings.TrimSpace(q) == \"\" { return errors.New(\"empty query in list\") } }","typeGuard":"func hasQueries(input map[string]any) bool {\n    qs, ok := input[\"queries\"].([]string)\n    return ok && len(qs) > 0\n}","tryCatchPattern":"res, err := tool.Execute(ctx, input)\nif err != nil && strings.Contains(err.Error(), \"no queries provided\") {\n    return promptUserForQuery(), nil\n}","preventionTips":["Use the exact parameter name 'queries' (plural)","Derive queries from validated user input, never from unset variables","Instruct the agent model that queries is mandatory","Log the outgoing params map when debugging empty-query failures"],"tags":["go","agent-tools","knowledge-search","input-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}