github/github-mcp-server · error

invalid ISO 8601 timestamp: %s (supported formats: YYYY-MM-D

Error message

invalid ISO 8601 timestamp: %s (supported formats: YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DD)

What it means

parseISOTimestamp accepts exactly two layouts — RFC 3339 (YYYY-MM-DDThh:mm:ssZ, e.g. 2023-01-15T14:30:00Z) and plain dates (YYYY-MM-DD) — and rejects everything else with this message echoing the bad input. Note RFC 3339 requires a timezone offset; a bare 'T' string without one fails.

Source

Thrown at pkg/github/issues.go:3180

func parseISOTimestamp(timestamp string) (time.Time, error) {
	if timestamp == "" {
		return time.Time{}, fmt.Errorf("empty timestamp")
	}

	// Try RFC3339 format (standard ISO 8601 with time)
	t, err := time.Parse(time.RFC3339, timestamp)
	if err == nil {
		return t, nil
	}

	// Try simple date format (YYYY-MM-DD)
	t, err = time.Parse("2006-01-02", timestamp)
	if err == nil {
		return t, nil
	}

	// Return error with supported formats
	return time.Time{}, fmt.Errorf("invalid ISO 8601 timestamp: %s (supported formats: YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DD)", timestamp)
}

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Format timestamps as YYYY-MM-DDThh:mm:ssZ (with explicit UTC 'Z' or numeric offset) or plain YYYY-MM-DD
  2. Convert from your local representation with time.Format(time.RFC3339) before sending
  3. For date-only semantics, send just YYYY-MM-DD

Example fix

// before
{"since":"2023-01-15 14:30:00"}
// after
{"since":"2023-01-15T14:30:00Z"}
Defensive patterns

Strategy: validation

Validate before calling

func normalizeTimestamp(s string) (string, error) {
	for _, layout := range []string{time.RFC3339, "2006-01-02"} {
		if t, err := time.Parse(layout, s); err == nil {
			return t.Format(layout), nil
		}
	}
	// last resort: try common local formats, then emit RFC3339
	for _, layout := range []string{"2006-01-02 15:04:05", "01/02/2006"} {
		if t, err := time.Parse(layout, s); err == nil {
			return t.Format(time.RFC3339), nil
		}
	}
	return "", fmt.Errorf("unrecognized timestamp %q", s)
}

Type guard

func isISOTimestamp(s string) bool {
	if _, err := time.Parse(time.RFC3339, s); err == nil {
		return true
	}
	_, err := time.Parse("2006-01-02", s)
	return err == nil
}

Prevention

When it happens

Trigger: Passing "2023-01-15 14:30:00" (space instead of T), "2023-01-15T14:30:00" (missing Z/offset), "01/15/2023", or an RFC3339 with fractional seconds and no zone.

Common situations: DB or log-derived timestamps in non-RFC3339 form; missing timezone info; dates built by string concatenation; RFC 3339 allows lowercase 't'/'z' but Go's time.RFC3339 parsing does not, so "2023-01-15t14:30:00z" also fails.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/477ccae93fa38d70. Report an issue: GitHub.