vxcontrol/pentagi · error

invalid time_end format (use ISO 8601, e.g. 2026-01-02T15:04

Error message

invalid time_end format (use ISO 8601, e.g. 2026-01-02T15:04:05Z): %w

What it means

Returned by the graphiti_search tool's temporal_window handler (backend/pkg/tools/graphiti_search.go) when args.TimeEnd cannot be parsed by parseGraphitiTime as ISO 8601 (e.g. 2026-01-02T15:04:05Z). Input validation error from the LLM tool call; fix by supplying a valid ISO 8601 timestamp for time_end.

Source

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

func (t *graphitiSearchTool) handleTemporalWindowSearch(
	ctx context.Context,
	groupID string,
	args GraphitiSearchAction,
	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,

View on GitHub (pinned to ea665308ba)

Solutions

  1. Format time_end as ISO 8601, e.g. 2026-08-31T23:59:59Z
  2. Ensure both time_start and time_end use the same canonical layout
  3. Inspect the wrapped cause for the precise parsing failure

Example fix

// before
{"time_end": "31/08/2026"}
// after
{"time_end": "2026-08-31T23:59:59Z"}
Defensive patterns

Strategy: validation

Validate before calling

te, err := time.Parse(time.RFC3339, args.TimeEnd)
if err != nil {
    return fmt.Errorf("time_end must be ISO 8601 (RFC3339): %w", err)
}

Type guard

func validISO8601(s string) bool {
    _, err := time.Parse(time.RFC3339, s)
    return err == nil
}

Prevention

When it happens

Trigger: Calling graphiti_search with search_type="temporal_window" and a malformed time_end value (wrong layout, locale format, invalid timezone) while time_start parsed fine.

Common situations: Agents writing 'now' or 'today' as time_end; truncated timestamps like "2026-08-31T24:00"; seconds omitted or fractional-second layout mismatches.

Related errors


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