vxcontrol/pentagi · error

time_end must be after time_start

Error message

time_end must be after time_start

What it means

After parsing, the temporal_window search validates that the window is ordered: time_end must come after time_start. This error fires when the parsed end timestamp is before the parsed start timestamp, which would produce an empty or nonsensical query window for Graphiti.

Solutions

  1. Swap the values so time_start < time_end
  2. Compute the window as start=now-minus-duration, end=now
  3. Re-check timezone offsets on both timestamps to ensure the intended order

Example fix

// before
{"time_start": "2026-08-31T00:00:00Z", "time_end": "2026-08-01T00:00:00Z"}
// after
{"time_start": "2026-08-01T00:00:00Z", "time_end": "2026-08-31T00:00:00Z"}
Defensive patterns

Strategy: validation

Validate before calling

if !end.After(start) {
    return errors.New("time_end must be after time_start")
}

Prevention

When it happens

Trigger: Passing time_start later than time_end, e.g. swapped values (start=2026-08-31, end=2026-08-01) or a negative window spanning a timezone mistake.

Common situations: Agents mixing up argument order; computing 'last 24h' with the offsets assigned to the wrong fields; timezone conversions flipping the ordering.

Related errors


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/439275b81023b6f4. Report an issue: GitHub.

Appendix: source

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

	observationObject *graphiti.Observation,
) (string, error) {
	// Validate temporal parameters
	if args.TimeStart == "" || args.TimeEnd == "" {
		return "", fmt.Errorf("time_start and time_end are required for temporal_window search")
	}

	timeStart, err := parseGraphitiTime(args.TimeStart)
	if err != nil {
		return "", fmt.Errorf("invalid time_start format (use ISO 8601, e.g. 2026-01-02T15:04:05Z): %w", err)
	}

	timeEnd, err := parseGraphitiTime(args.TimeEnd)
	if err != nil {
		return "", fmt.Errorf("invalid time_end format (use ISO 8601, e.g. 2026-01-02T15:04:05Z): %w", err)
	}

	if timeEnd.Before(timeStart) {
		return "", fmt.Errorf("time_end must be after time_start")
	}

	maxResults := args.MaxResults.Int()
	if maxResults <= 0 {
		maxResults = DefaultTemporalMaxResults
	}

	req := graphiti.TemporalSearchRequest{
		Query:       args.Query,
		GroupID:     &groupID,
		TimeStart:   timeStart,
		TimeEnd:     timeEnd,
		MaxResults:  maxResults,
		Observation: observationObject,
	}

	resp, err := t.graphitiClient.TemporalWindowSearch(ctx, req)
	if err != nil {

View on GitHub (pinned to ea665308ba)