{"record":{"id":"98d77870ef5e07aa","repo":"pocketbase/pocketbase","slug":"todaystart-w","errorCode":null,"errorMessage":"@todayStart: %w","messagePattern":"@todayStart: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/search/identifier_macros.go","lineNumber":73,"sourceCode":"\t\"@day\": func() (any, error) {\n\t\treturn timeNow().UTC().Day(), nil\n\t},\n\t\"@month\": func() (any, error) {\n\t\treturn int(timeNow().UTC().Month()), nil\n\t},\n\t\"@weekday\": func() (any, error) {\n\t\treturn int(timeNow().UTC().Weekday()), nil\n\t},\n\t\"@year\": func() (any, error) {\n\t\treturn timeNow().UTC().Year(), nil\n\t},\n\t\"@todayStart\": func() (any, error) {\n\t\ttoday := timeNow().UTC()\n\t\tstart := time.Date(today.Year(), today.Month(), today.Day(), 0, 0, 0, 0, time.UTC)\n\n\t\td, err := types.ParseDateTime(start)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"@todayStart: %w\", err)\n\t\t}\n\n\t\treturn d.String(), nil\n\t},\n\t\"@todayEnd\": func() (any, error) {\n\t\ttoday := timeNow().UTC()\n\n\t\tstart := time.Date(today.Year(), today.Month(), today.Day(), 23, 59, 59, 999999999, time.UTC)\n\n\t\td, err := types.ParseDateTime(start)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"@todayEnd: %w\", err)\n\t\t}\n\n\t\treturn d.String(), nil\n\t},\n\t\"@monthStart\": func() (any, error) {\n\t\ttoday := timeNow().UTC()","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/pocketbase/pocketbase/blob/5d217ddb50cb144d80a5d0b0bdf11b52b2c3e457/tools/search/identifier_macros.go#L55-L91","documentation":"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.","triggerScenarios":"A filter using `@todayStart` combined with a `types.ParseDateTime` that rejects the normalized midnight UTC time.","commonSituations":"Version mismatches or custom datetime parsers; effectively unreachable on stock builds.","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"],"exampleFix":"// before\nfilter := \"created >= @todayStart\"\n// after\nfilter := \"created >= '2026-08-15 00:00:00.000Z'\"","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"result, err := search.FilterData(f, resolver)\nif err != nil && strings.Contains(err.Error(), \"@todayStart:\") {\n    // retry with explicit midnight UTC literal\n}","preventionTips":["Keep core packages in sync","Prefer explicit literals in long-lived filters","Regression-test date macros after version bumps"],"tags":["pocketbase","filter","macro","datetime","search"],"backgroundTag":null,"analyzedSha":"5d217ddb50cb144d80a5d0b0bdf11b52b2c3e457","analyzedAt":"2026-08-15T10:06:33.165Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}