vxcontrol/pentagi · error

query parameter is required

Error message

query parameter is required

What it means

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".

Source

Thrown at backend/pkg/tools/graphiti_search.go:167

		return "Graphiti knowledge graph is not enabled. No historical context or memory data is available for this search.", nil
	}

	logger := logrus.WithContext(ctx).WithFields(enrichLogrusFields(t.flowID, t.taskID, t.subtaskID, logrus.Fields{
		"tool": name,
		"args": string(args),
	}))

	var searchArgs GraphitiSearchAction
	if err := json.Unmarshal(args, &searchArgs); err != nil {
		logger.WithError(err).Error("failed to unmarshal search arguments")
		return "", fmt.Errorf("failed to unmarshal search arguments: %w", err)
	}

	searchArgs.Query = strings.TrimSpace(searchArgs.Query)

	if searchArgs.Query == "" {
		logger.Error("query parameter is required")
		return "", fmt.Errorf("query parameter is required")
	}
	if searchArgs.SearchType == "" {
		logger.Error("search_type parameter is required")
		return "", fmt.Errorf("search_type parameter is required")
	}

	ctx, observation := obs.Observer.NewObservation(ctx)

	retrieverTitle, ok := graphitiRetrieverTitles[searchArgs.SearchType.String()]
	if !ok {
		retrieverTitle = "retrieve context from graphiti knowledge graph"
	}

	retriever := observation.Retriever(
		langfuse.WithRetrieverName(retrieverTitle),
		langfuse.WithRetrieverInput(searchArgs.retrieverInput(t.groupID)),
		langfuse.WithRetrieverMetadata(langfuse.Metadata{
			"tool_name":   name,

View on GitHub (pinned to ea665308ba)

Solutions

  1. Provide a non-empty natural-language query string describing what to find or how to rank the results.
  2. Do not treat query as optional for entity_relationships/entity_by_label — fill it even when center_node_uuid or node_labels is present.
  3. Write the query in English per the schema, since the shared graph is indexed in English.
  4. If the intent is a broad 'latest activity' lookup, use search_type=recent_context with a short descriptive query instead of an empty one.

Example fix

// before
{"search_type": "entity_relationships", "query": "", "center_node_uuid": "..."}
// after
{"search_type": "entity_relationships", "query": "paths from this host to credential stores", "center_node_uuid": "..."}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(args.Query) == "" {
    return errors.New("query parameter is required")
}

Try / catch

if _, err := graphitiSearchHandle(ctx, args); err != nil {
    if err.Error() == "query parameter is required" {
        // populate a descriptive English query and retry once
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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 vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/184ab93119978a71. Report an issue: GitHub.