{"record":{"id":"7884bddd6d3a348b","repo":"Tencent/WeKnora","slug":"query-parameter-is-required","errorCode":null,"errorMessage":"query parameter is required","messagePattern":"query parameter is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/tools/web_search.go","lineNumber":136,"sourceCode":"\t// Parse args from json.RawMessage\n\tvar input WebSearchInput\n\tif err := json.Unmarshal(args, &input); err != nil {\n\t\tlogger.Errorf(ctx, \"[Tool][WebSearch] Failed to parse args: %v\", err)\n\t\treturn &types.ToolResult{\n\t\t\tSuccess: false,\n\t\t\tError:   fmt.Sprintf(\"Failed to parse args: %v\", err),\n\t\t}, err\n\t}\n\n\t// Parse query\n\tquery := input.Query\n\tok := query != \"\"\n\tif !ok || query == \"\" {\n\t\tlogger.Errorf(ctx, \"[Tool][WebSearch] Query is required\")\n\t\treturn &types.ToolResult{\n\t\t\tSuccess: false,\n\t\t\tError:   \"query parameter is required\",\n\t\t}, fmt.Errorf(\"query parameter is required\")\n\t}\n\n\tlogger.Infof(ctx, \"[Tool][WebSearch] Searching with query: %s, max_results: %d\", query, t.maxResults)\n\n\t// Get tenant ID from context\n\ttenantID := uint64(0)\n\tif tid, ok := ctx.Value(types.TenantIDContextKey).(uint64); ok {\n\t\ttenantID = tid\n\t}\n\n\tif tenantID == 0 {\n\t\tlogger.Errorf(ctx, \"[Tool][WebSearch] Workspace ID not found in context\")\n\t\treturn &types.ToolResult{\n\t\t\tSuccess: false,\n\t\t\tError:   \"workspace ID not found in context\",\n\t\t}, fmt.Errorf(\"workspace ID not found in context\")\n\t}\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/agent/tools/web_search.go#L118-L154","documentation":"Argument validation in WebSearchTool.Execute: the parsed WebSearchInput.Query is empty (either absent in the JSON args or an empty string). The guard fires before any network call, returning both a failed ToolResult ('query parameter is required') and this error to signal malformed tool invocation.","triggerScenarios":"Thrown at internal/agent/tools/web_search.go:136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty 'query' in the tool arguments","Validate at input-schema level to reject empty queries earlier"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}