atuinsh/atuin · error
issue in stats next query
Error message
issue in stats next query
What it means
The second of the seven stats expect() panics (database.rs:952), rendering the 'next' builder for `atuin stats`. Identical semantics to its siblings: SqlBuilder::sql() returns Err only when builder misuse leaves an unrenderable state, the fixed query shape means no runtime input can cause it, and the message marks it as an Atuin bug to report. After rendering, all seven queries run concurrently on the pool via tokio::try_join!.
Source
Thrown at crates/atuin-client/src/database.rs:952
.and_where("command = ?1")
.group_by("day_of_week");
// Intentionally format the string with 01 hardcoded. We want the average runtime for the
// _entire month_, but will later parse it as a datetime for sorting
// Sqlite has no datetime so we cannot do it there, and otherwise sorting will just be a
// string sort, which won't be correct.
let mut duration_over_time = SqlBuilder::select_from("history");
duration_over_time
.fields(&[
"strftime('01-%m-%Y', ROUND(timestamp / 1000000000), 'unixepoch') AS month_year",
"avg(duration) as duration",
])
.and_where("command = ?1")
.group_by("month_year")
.having("duration > 0");
let prev = prev.sql().expect("issue in stats previous query");
let next = next.sql().expect("issue in stats next query");
let total = total.sql().expect("issue in stats average query");
let average = average.sql().expect("issue in stats previous query");
let exits = exits.sql().expect("issue in stats exits query");
let day_of_week = day_of_week.sql().expect("issue in stats day of week query");
let duration_over_time = duration_over_time
.sql()
.expect("issue in stats duration over time query");
// The queries are all independent, so run them concurrently on the pool.
let (prev, next, total, average, exits, day_of_week, duration_over_time): (
_,
_,
(i64,),
(f64,),
Vec<(i64, i64)>,
Vec<(String, i64)>,
Vec<(String, f64)>,
) = tokio::try_join!(View on GitHub (pinned to 202f6ad98e)
Solutions
- Update Atuin and report the panic upstream with a backtrace
- Rebuild from a clean checkout to rule out a stale mixed build
- Developers: smoke-test `atuin stats` after any change near database.rs:930-960
- Add unit coverage rendering every stats builder
Defensive patterns
Strategy: validation
Try / catch
let handle = std::thread::spawn(move || db.stats());
if handle.join().is_err() { /* internal stats-query panic: report upstream */ } Prevention
- Smoke-test `atuin stats` after development changes near the stats queries
- Keep each stats builder independently unit-tested for rendering
- Report upstream with the exact panic string and version
- Prefer clean rebuilds when bisecting suspected regressions
When it happens
Trigger: Running `atuin stats` with a development build whose 'next' builder construction was broken by a local change.
Common situations: Development-only; a custom/patched Atuin build with a regression in the stats query assembly.
Related errors
- issue in stats previous query
- issue in stats average query
- issue in stats exits query
- issue in stats duration over time query
- bug in list query. please report
AI-assisted analysis of atuinsh/atuin@202f6ad98e (2026-08-16).
Data as JSON: /api/errors/1d70e0af2043c21c.
Report an issue: GitHub.