pocketbase/pocketbase · error
@todayStart: %w
Error message
@todayStart: %w
What it means
Thrown by the `@todayStart` macro when `types.ParseDateTime` fails on the UTC start-of-day timestamp constructed via `time.Date(...)`. The macro expands in filters like `created >= @todayStart`. The constructed date is always valid, so this error guards against internal parser failures, not malformed user filters.
Source
Thrown at tools/search/identifier_macros.go:73
"@day": func() (any, error) {
return timeNow().UTC().Day(), nil
},
"@month": func() (any, error) {
return int(timeNow().UTC().Month()), nil
},
"@weekday": func() (any, error) {
return int(timeNow().UTC().Weekday()), nil
},
"@year": func() (any, error) {
return timeNow().UTC().Year(), nil
},
"@todayStart": func() (any, error) {
today := timeNow().UTC()
start := time.Date(today.Year(), today.Month(), today.Day(), 0, 0, 0, 0, time.UTC)
d, err := types.ParseDateTime(start)
if err != nil {
return "", fmt.Errorf("@todayStart: %w", err)
}
return d.String(), nil
},
"@todayEnd": func() (any, error) {
today := timeNow().UTC()
start := time.Date(today.Year(), today.Month(), today.Day(), 23, 59, 59, 999999999, time.UTC)
d, err := types.ParseDateTime(start)
if err != nil {
return "", fmt.Errorf("@todayEnd: %w", err)
}
return d.String(), nil
},
"@monthStart": func() (any, error) {
today := timeNow().UTC()View on GitHub (pinned to 5d217ddb50)
Solutions
- Update PocketBase
- Replace `@todayStart` with an explicit `'YYYY-MM-DD 00:00:00.000Z'` literal
- Report a parser regression if reproducible on stock code
Example fix
// before filter := "created >= @todayStart" // after filter := "created >= '2026-08-15 00:00:00.000Z'"
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
result, err := search.FilterData(f, resolver)
if err != nil && strings.Contains(err.Error(), "@todayStart:") {
// retry with explicit midnight UTC literal
} Prevention
- Keep core packages in sync
- Prefer explicit literals in long-lived filters
- Regression-test date macros after version bumps
When it happens
Trigger: A filter using `@todayStart` combined with a `types.ParseDateTime` that rejects the normalized midnight UTC time.
Common situations: Version mismatches or custom datetime parsers; effectively unreachable on stock builds.
Related errors
AI-assisted analysis of pocketbase/pocketbase@5d217ddb50 (2026-08-15).
Data as JSON: /api/errors/98d77870ef5e07aa.
Report an issue: GitHub.