Skip to content

Crash when switching from Daylight Saving Time #639

@Pa3u3u

Description

@Pa3u3u

Description

On Sunday, Czechia switched from 3:00 CEST (+2:00) to 2:00 CET (+1:00). This caused taskwarrior-tui to panic:

The application panicked (crashed).
  Ambiguous local time, ranging from 2025-10-26T02:00:00.100942997+01:00 to 2025-10-26T02:00:00.100942997+02:00
in src/task_report.rs, line 22
thread: main

Steps to reproduce

I managed to reproduce the crash using faketime:

export TASKDATA=$(mktemp -d task.XXXXXX)
TZ=Europe/Prague faketime -f '@2025-10-26 01:59:59' task add test
RUST_BACKTRACE=full TZ=Europe/Prague faketime -f '@2025-10-26 01:59:59 x1000' target/debug/taskwarrior-tui

When the age of the task reaches 1h, then after a few seconds, the application crashes:

Backtrace (most recent call first):
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chrono-0.4.38/src/offset/mod.rs", line 264, in chrono::offset::LocalResult<T>::unwrap
    panic!("Ambiguous local time, ranging from {:?} to {:?}", t1, t2)
  File "/tmp/taskwarrior-tui/src/task_report.rs", line 22, in taskwarrior_tui::task_report::vague_format_date_time
    let to_dt = Local.from_local_datetime(&to_dt).unwrap();
  File "/tmp/taskwarrior-tui/src/task_report.rs", line 307, in taskwarrior_tui::task_report::TaskReportTable::get_string_attribute
    "entry.age" => vague_format_date_time(
  File "/tmp/taskwarrior-tui/src/task_report.rs", line 214, in taskwarrior_tui::task_report::TaskReportTable::generate_table
    let s = self.get_string_attribute(name, task, tasks);
  File "/tmp/taskwarrior-tui/src/app.rs", line 1281, in taskwarrior_tui::app::TaskwarriorTui::get_task_report
    self.task_report_table.generate_table(&self.tasks);
  File "/tmp/taskwarrior-tui/src/app.rs", line 1189, in taskwarrior_tui::app::TaskwarriorTui::draw_task_report
    let (tasks, headers) = self.get_task_report();
  File "/tmp/taskwarrior-tui/src/app.rs", line 546, in taskwarrior_tui::app::TaskwarriorTui::draw_task
    self.draw_task_report(f, split_task_layout[0]);
  File "/tmp/taskwarrior-tui/src/app.rs", line 452, in taskwarrior_tui::app::TaskwarriorTui::draw
    Mode::Tasks(action) => self.draw_task(f, main_layout, action),
  File "/tmp/taskwarrior-tui/src/app.rs", line 383, in taskwarrior_tui::app::TaskwarriorTui::run::{{closure}}::{{closure}}
    terminal.draw(|f| self.draw(f))?;
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ratatui-0.26.3/src/terminal/terminal.rs", line 269, in ratatui::terminal::terminal::Terminal<B>::draw
    f(&mut frame);
  File "/tmp/taskwarrior-tui/src/app.rs", line 383, in taskwarrior_tui::app::TaskwarriorTui::run::{{closure}}
    terminal.draw(|f| self.draw(f))?;
  File "/tmp/taskwarrior-tui/src/main.rs", line 117, in taskwarrior_tui::tui_main::{{closure}}
    let r = app.run(&mut terminal).await;
  File "/tmp/taskwarrior-tui/src/main.rs", line 187, in taskwarrior_tui::main::{{closure}}
    .block_on(async { tui_main(report).await });
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/park.rs", line 281, in tokio::runtime::park::CachedParkThread::block_on::{{closure}}
    if let Ready(v) = crate::runtime::coop::budget(|| f.as_mut().poll(&mut cx)) {
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/coop.rs", line 107, in tokio::runtime::coop::with_budget
    f()
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/coop.rs", line 73, in tokio::runtime::coop::budget
    with_budget(Budget::initial(), f)
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/park.rs", line 281, in tokio::runtime::park::CachedParkThread::block_on
    if let Ready(v) = crate::runtime::coop::budget(|| f.as_mut().poll(&mut cx)) {
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/context/blocking.rs", line 66, in tokio::runtime::context::blocking::BlockingRegionGuard::block_on
    park.block_on(f)
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/scheduler/multi_thread/mod.rs", line 87, in tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
    blocking.block_on(future).expect("failed to park thread")
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/context/runtime.rs", line 65, in tokio::runtime::context::runtime::enter_runtime
    return f(&mut guard.blocking);
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/scheduler/multi_thread/mod.rs", line 86, in tokio::runtime::scheduler::multi_thread::MultiThread::block_on
    crate::runtime::context::enter_runtime(handle, true, |blocking| {
  File "/home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.38.0/src/runtime/runtime.rs", line 349, in tokio::runtime::runtime::Runtime::block_on
    Scheduler::MultiThread(exec) => exec.block_on(&self.handle.inner, future),
  File "/tmp/taskwarrior-tui/src/main.rs", line 187, in taskwarrior_tui::main
    .block_on(async { tui_main(report).await });

The application panicked (crashed).
  Ambiguous local time, ranging from 2025-10-26T02:00:04.706879+01:00 to 2025-10-26T02:00:04.706879+02:00
in src/task_report.rs, line 22
thread: main

I tried this without the x1000 modifier and after an hour or so, the application crashed too. I was not able to tell faketime to set 2:59:59 CEST, unfortunately, that's why it's 1:59:59 CEST and x1000.

Environment

  • Operating System: Linux 6.12.31
  • Installation: GitHub
  • taskwarrior-tui version: 0.26.4
  • task version: 3.4.1
  • LANG=en_US.UTF-8

Related issues

I noted there is #542, which has a similar problem for repeated tasks. The example above crashes even for tasks with no attributes except description, and with a different error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions