{"record":{"id":"8075e8a5ea9170e9","repo":"risingwavelabs/risingwave","slug":"failed-to-parse-the-timestamp-ts-with-the-specif","errorCode":null,"errorMessage":"failed to parse the timestamp {ts} with the specified time zone {tz}","messagePattern":"failed to parse the timestamp (.+?) with the specified time zone (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/frontend/src/optimizer/plan_node/utils.rs","lineNumber":540,"sourceCode":"        AsOf::TimestampString(ts) => {\n            let date_time = speedate::DateTime::parse_str_rfc3339(ts)\n                .map_err(|_e| anyhow!(\"failed to parse the timestamp\"))?;\n            if date_time.time.tz_offset.is_none() {\n                // If the input does not specify a time zone, use the time zone set by the \"SET TIME ZONE\" command.\n                risingwave_expr::expr_context::TIME_ZONE::try_with(|set_time_zone| {\n                    let tz =\n                        Timestamptz::lookup_time_zone(set_time_zone).map_err(|e| anyhow!(e))?;\n                    match tz.with_ymd_and_hms(\n                        date_time.date.year.into(),\n                        date_time.date.month.into(),\n                        date_time.date.day.into(),\n                        date_time.time.hour.into(),\n                        date_time.time.minute.into(),\n                        date_time.time.second.into(),\n                    ) {\n                        MappedLocalTime::Single(d) => Ok(d.timestamp()),\n                        MappedLocalTime::Ambiguous(_, _) | MappedLocalTime::None => {\n                            Err(anyhow!(format!(\n                                \"failed to parse the timestamp {ts} with the specified time zone {tz}\"\n                            )))\n                        }\n                    }\n                })??\n            } else {\n                date_time.timestamp_tz()\n            }\n        }\n        AsOf::VersionNum(_) | AsOf::VersionString(_) => {\n            return Err(ErrorCode::NotSupported(\n                \"AS OF VERSION is not supported\".to_owned(),\n                \"please use AS OF TIMESTAMP\".to_owned(),\n            )\n            .into());\n        }\n        AsOf::ProcessTimeWithInterval((value, leading_field)) => {\n            let interval = Interval::parse_with_fields(","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/optimizer/plan_node/utils.rs#L522-L558","documentation":"After resolving the timezone, to_batch_query_epoch converts the AS OF timestamp's Y/M/D H:M:S components via tz.with_ymd_and_hms. If the local time is ambiguous (DST overlap) or nonexistent (DST gap), chrono returns Ambiguous/None and this error is raised because a single unambiguous epoch cannot be computed.","triggerScenarios":"A time travel query with an AS OF timestamp string that falls inside a DST spring-forward gap or a fall-back overlap for the effective time zone, e.g. '2024-03-10T02:30:00' with a US timezone.","commonSituations":"Queries pinned to wall-clock times during daylight-saving transitions in the session time zone; timezoneless timestamps that land on nonexistent local times.","solutions":["Include an explicit UTC offset in the timestamp (e.g. '2024-03-10T02:30:00-05:00') to sidestep DST ambiguity.","Choose a timestamp outside the DST transition window.","Perform the time travel using epoch seconds (AsOf::TimestampNum) instead of a wall-clock string."],"exampleFix":"// before\nSELECT * FROM t AS OF TIMESTAMP '2024-03-10T02:30:00'; -- nonexistent local time\n// after\nSELECT * FROM t AS OF TIMESTAMP '2024-03-10T03:30:00-05:00';","handlingStrategy":"validation","validationCode":"// avoid DST-ambiguous local times: use UTC or explicit offset\nlet dt = chrono::DateTime::parse_from_rfc3339(\"2024-03-10T02:30:00-05:00\").unwrap();","typeGuard":"fn has_explicit_offset(s: &str) -> bool { chrono::DateTime::parse_from_rfc3339(s).map(|d| d.offset().fix().local_minus_utc() != 0).unwrap_or(false) }","tryCatchPattern":"match res {\n    Err(e) if e.to_string().contains(\"with the specified time zone\") => eprintln!(\"timestamp is DST-ambiguous/nonexistent; add explicit offset or use UTC\"),\n    other => other?,\n}","preventionTips":["Prefer UTC or explicit-offset timestamps in time travel queries.","Skip wall-clock times within ±1h of DST transitions in the session zone.","Use epoch-based AS OF for automated/CI queries."],"tags":["sql","time-travel","dst","timezone"],"backgroundTag":"invalid-date-format","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}