gastownhall/beads · error
invalid created time: %w
Error message
invalid created time: %w
What it means
This wraps a failure from parseTimeValue while evaluating a `created` comparison: the value could not be parsed as a relative time (e.g. 7d, 24h, yesterday) or an absolute timestamp. The underlying parse error is preserved via %w so the root cause (unknown format, bad duration suffix) is visible in the wrapped chain.
Source
Thrown at internal/query/evaluator.go:335
filter.EmptyDescription = true
} else {
filter.DescriptionContains = comp.Value
}
return nil
}
func (e *Evaluator) applyNotesFilter(comp *ComparisonNode, filter *types.IssueFilter) error {
if comp.Op != OpEquals {
return fmt.Errorf("notes only supports = operator")
}
filter.NotesContains = comp.Value
return nil
}
func (e *Evaluator) applyCreatedFilter(comp *ComparisonNode, filter *types.IssueFilter) error {
t, err := e.parseTimeValue(comp)
if err != nil {
return fmt.Errorf("invalid created time: %w", err)
}
switch comp.Op {
case OpEquals:
// For equals, set both before and after to bracket the day
dayStart := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
dayEnd := dayStart.Add(24 * time.Hour)
filter.CreatedAfter = &dayStart
filter.CreatedBefore = &dayEnd
case OpGreater:
filter.CreatedAfter = &t
case OpGreaterEq:
filter.CreatedAfter = &t
case OpLess:
filter.CreatedBefore = &t
case OpLessEq:
endOfDay := time.Date(t.Year(), t.Month(), t.Day(), 23, 59, 59, 999999999, t.Location())
filter.CreatedBefore = &endOfDay
default:View on GitHub (pinned to 71377f2769)
Solutions
- Use a supported relative duration: `created > 7d`, `created < 24h`
- Use an absolute timestamp in a format ParseRelativeTime accepts (e.g. RFC3339 / `2026-08-30`)
- Read the wrapped %w cause in the error chain to see the exact parse failure and correct the value
Example fix
// before bd list 'created > 7 days' // after bd list 'created > 7d'
Defensive patterns
Strategy: validation
Validate before calling
// Validate the created value parses before running the query
import "time"
func validCreatedValue(v string) bool {
if regexp.MustCompile(`^\d+[dhmsw]$`).MatchString(v) {
return true // duration form like 7d, 24h
}
_, err := time.Parse(time.RFC3339, v)
return err == nil
}
if !validCreatedValue(value) { return fmt.Errorf("bad created value: %q", value) } Type guard
func isParseableTime(v string) bool {
_, err := timeparsing.ParseRelativeTime(v, time.Now())
return err == nil
} Try / catch
if err := eval.Eval(node); err != nil {
var pe *time.ParseError
if errors.As(err, &pe) || strings.Contains(err.Error(), "invalid created time") {
// correct the date/duration value and retry
}
} Prevention
- Prefer compact durations: 7d, 24h
- Use ISO dates (2026-08-30 or RFC3339) for absolute times
- Interpolate date variables through the same parser before building the query
- Unwrap the %w cause to see the exact parse failure
When it happens
Trigger: Queries like `created = 7x`, `created > tomorrowish`, `created < 2026-13-45`, or any unparseable value after `created`; parseTimeValue dispatches to parseDurationAgo for duration tokens or timeparsing.ParseRelativeTime otherwise.
Common situations: Typos in relative dates (`created > 7days` vs `7d`); locale-formatted dates; misspelled keywords like `last week` when only compact forms are supported; scripts interpolating empty or malformed date strings.
Related errors
- invalid updated time: %w
- invalid closed time: %w
- created does not support %s operator
- ErrQuery
- failed to search issues: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/eeb6b1a625e4d2dd.
Report an issue: GitHub.