gastownhall/beads · error

invalid started time: %w

Error message

invalid started time: %w

What it means

Thrown when the value in a `started <time>` comparison cannot be parsed as a valid time by parseTimeValue. The evaluator wraps the underlying parse error, so the root cause (bad date format) is included via %w.

Source

Thrown at internal/query/evaluator.go:409

	case OpGreater:
		filter.ClosedAfter = &t
	case OpGreaterEq:
		filter.ClosedAfter = &t
	case OpLess:
		filter.ClosedBefore = &t
	case OpLessEq:
		endOfDay := time.Date(t.Year(), t.Month(), t.Day(), 23, 59, 59, 999999999, t.Location())
		filter.ClosedBefore = &endOfDay
	default:
		return fmt.Errorf("closed does not support %s operator", comp.Op.String())
	}
	return nil
}

func (e *Evaluator) applyStartedFilter(comp *ComparisonNode, filter *types.IssueFilter) error {
	t, err := e.parseTimeValue(comp)
	if err != nil {
		return fmt.Errorf("invalid started time: %w", err)
	}
	switch comp.Op {
	case OpGreater:
		filter.StartedAfter = &t
	case OpGreaterEq:
		filter.StartedAfter = &t
	case OpLess:
		filter.StartedBefore = &t
	case OpLessEq:
		endOfDay := time.Date(t.Year(), t.Month(), t.Day(), 23, 59, 59, 999999999, t.Location())
		filter.StartedBefore = &endOfDay
	default:
		return fmt.Errorf("started does not support %s operator", comp.Op.String())
	}
	return nil
}

func (e *Evaluator) applyIDFilter(comp *ComparisonNode, filter *types.IssueFilter) error {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Fix the time value to a supported format (ISO-style, e.g. 2024-06-01 or 2024-06-01T15:04:05).
  2. Read the wrapped %w cause in the message to see which parse step failed.
  3. Quote the query in your shell so spaces in the datetime are not split.

Example fix

// before
bd list 'started > June 1st'
// after
bd list 'started > 2024-06-01'
Defensive patterns

Strategy: validation

Validate before calling

func validateStartedValue(v string) error {
	if _, err := time.Parse("2006-01-02", v); err != nil {
		if _, err := time.Parse(time.RFC3339, v); err != nil {
			return fmt.Errorf("started value %q is not a supported time format", v)
		}
	}
	return nil
}

Try / catch

res, err := eval.Query(q)
if err != nil && strings.HasPrefix(err.Error(), "invalid started time:") {
	// surface the wrapped parse cause to the user
}

Prevention

When it happens

Trigger: A query like `started > not-a-date`, `started >= 2024-13-45`, or using a format the parser does not recognize (e.g. `01/02/2024` if only ISO-like formats are supported).

Common situations: Locale-formatted dates in saved queries; typos like `2024-6-1` vs expected zero-padded forms; shell quoting stripping characters from the date string.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/69a2787da71290e5. Report an issue: GitHub.