{"record":{"id":"184ab93119978a71","repo":"vxcontrol/pentagi","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":"backend/pkg/tools/graphiti_search.go","lineNumber":167,"sourceCode":"\t\treturn \"Graphiti knowledge graph is not enabled. No historical context or memory data is available for this search.\", nil\n\t}\n\n\tlogger := logrus.WithContext(ctx).WithFields(enrichLogrusFields(t.flowID, t.taskID, t.subtaskID, logrus.Fields{\n\t\t\"tool\": name,\n\t\t\"args\": string(args),\n\t}))\n\n\tvar searchArgs GraphitiSearchAction\n\tif err := json.Unmarshal(args, &searchArgs); err != nil {\n\t\tlogger.WithError(err).Error(\"failed to unmarshal search arguments\")\n\t\treturn \"\", fmt.Errorf(\"failed to unmarshal search arguments: %w\", err)\n\t}\n\n\tsearchArgs.Query = strings.TrimSpace(searchArgs.Query)\n\n\tif searchArgs.Query == \"\" {\n\t\tlogger.Error(\"query parameter is required\")\n\t\treturn \"\", fmt.Errorf(\"query parameter is required\")\n\t}\n\tif searchArgs.SearchType == \"\" {\n\t\tlogger.Error(\"search_type parameter is required\")\n\t\treturn \"\", fmt.Errorf(\"search_type parameter is required\")\n\t}\n\n\tctx, observation := obs.Observer.NewObservation(ctx)\n\n\tretrieverTitle, ok := graphitiRetrieverTitles[searchArgs.SearchType.String()]\n\tif !ok {\n\t\tretrieverTitle = \"retrieve context from graphiti knowledge graph\"\n\t}\n\n\tretriever := observation.Retriever(\n\t\tlangfuse.WithRetrieverName(retrieverTitle),\n\t\tlangfuse.WithRetrieverInput(searchArgs.retrieverInput(t.groupID)),\n\t\tlangfuse.WithRetrieverMetadata(langfuse.Metadata{\n\t\t\t\"tool_name\":   name,","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/graphiti_search.go#L149-L185","documentation":"After successful unmarshal, graphiti_search trims the query and rejects an empty one. The schema marks query as required for EVERY search_type — even entity_relationships/entity_by_label where a UUID or labels are supplied — because it re-ranks and filters the graph traversal. An empty/whitespace-only query returns the plain error \"query parameter is required\".","triggerScenarios":"Calling graphiti_search with query omitted, \"\", or only whitespace (e.g. \"   \"); the model assuming query is optional when center_node_uuid or node_labels is set; a template that interpolates an empty variable into the query field.","commonSituations":"LLM relies solely on center_node_uuid for entity_relationships and leaves query blank; agents copying call templates with a placeholder {{query}} left unfilled; prompts in non-English workflows where the model emits an empty English query field it was supposed to fill.","solutions":["Provide a non-empty natural-language query string describing what to find or how to rank the results.","Do not treat query as optional for entity_relationships/entity_by_label — fill it even when center_node_uuid or node_labels is present.","Write the query in English per the schema, since the shared graph is indexed in English.","If the intent is a broad 'latest activity' lookup, use search_type=recent_context with a short descriptive query instead of an empty one."],"exampleFix":"// before\n{\"search_type\": \"entity_relationships\", \"query\": \"\", \"center_node_uuid\": \"...\"}\n// after\n{\"search_type\": \"entity_relationships\", \"query\": \"paths from this host to credential stores\", \"center_node_uuid\": \"...\"}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(args.Query) == \"\" {\n    return errors.New(\"query parameter is required\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := graphitiSearchHandle(ctx, args); err != nil {\n    if err.Error() == \"query parameter is required\" {\n        // populate a descriptive English query and retry once\n    }\n}","preventionTips":["Treat query as mandatory for every search_type, including entity_relationships and entity_by_label.","Write the query in English; the shared graph is indexed in English.","Reject/repair calls in your client wrapper when required string fields are empty before sending.","Do not leave template placeholders like {{query}} unfilled."],"tags":["validation","required-parameter","go","llm"],"backgroundTag":"missing-required-argument","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}