{"record":{"id":"eeb6b1a625e4d2dd","repo":"gastownhall/beads","slug":"invalid-created-time-w","errorCode":null,"errorMessage":"invalid created time: %w","messagePattern":"invalid created time: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/query/evaluator.go","lineNumber":335,"sourceCode":"\t\tfilter.EmptyDescription = true\n\t} else {\n\t\tfilter.DescriptionContains = comp.Value\n\t}\n\treturn nil\n}\n\nfunc (e *Evaluator) applyNotesFilter(comp *ComparisonNode, filter *types.IssueFilter) error {\n\tif comp.Op != OpEquals {\n\t\treturn fmt.Errorf(\"notes only supports = operator\")\n\t}\n\tfilter.NotesContains = comp.Value\n\treturn nil\n}\n\nfunc (e *Evaluator) applyCreatedFilter(comp *ComparisonNode, filter *types.IssueFilter) error {\n\tt, err := e.parseTimeValue(comp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid created time: %w\", err)\n\t}\n\tswitch comp.Op {\n\tcase OpEquals:\n\t\t// For equals, set both before and after to bracket the day\n\t\tdayStart := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())\n\t\tdayEnd := dayStart.Add(24 * time.Hour)\n\t\tfilter.CreatedAfter = &dayStart\n\t\tfilter.CreatedBefore = &dayEnd\n\tcase OpGreater:\n\t\tfilter.CreatedAfter = &t\n\tcase OpGreaterEq:\n\t\tfilter.CreatedAfter = &t\n\tcase OpLess:\n\t\tfilter.CreatedBefore = &t\n\tcase OpLessEq:\n\t\tendOfDay := time.Date(t.Year(), t.Month(), t.Day(), 23, 59, 59, 999999999, t.Location())\n\t\tfilter.CreatedBefore = &endOfDay\n\tdefault:","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/query/evaluator.go#L317-L353","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nbd list 'created > 7 days'\n// after\nbd list 'created > 7d'","handlingStrategy":"validation","validationCode":"// Validate the created value parses before running the query\nimport \"time\"\nfunc validCreatedValue(v string) bool {\n\tif regexp.MustCompile(`^\\d+[dhmsw]$`).MatchString(v) {\n\t\treturn true // duration form like 7d, 24h\n\t}\n\t_, err := time.Parse(time.RFC3339, v)\n\treturn err == nil\n}\nif !validCreatedValue(value) { return fmt.Errorf(\"bad created value: %q\", value) }","typeGuard":"func isParseableTime(v string) bool {\n\t_, err := timeparsing.ParseRelativeTime(v, time.Now())\n\treturn err == nil\n}","tryCatchPattern":"if err := eval.Eval(node); err != nil {\n\tvar pe *time.ParseError\n\tif errors.As(err, &pe) || strings.Contains(err.Error(), \"invalid created time\") {\n\t\t// correct the date/duration value and retry\n\t}\n}","preventionTips":["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"],"tags":["query","time-parsing","created","invalid-input"],"backgroundTag":"invalid-date-format","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}