Ray's Knowledge Base
Unlock

hyperfine 2 moves the median in --export-json and wants --shell=default spelled out

PitfallVerified 22 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

A bench script reads .results[0].median from hyperfine --export-json and jq fails with null (null) and number (1000) cannot be multiplied. A command with < fails with contains unquoted shell syntax ('<'), and -S default then fails with exit 127 ("Command 'default' terminated").

Cause#

hyperfine 2.0 writes timings under .results[0].summary.time_wall_clock (median, mean), not .results[0].median as 1.x did. It also refuses shell syntax unless the shell is chosen, and -S default is read as a shell named default followed by the command.

Fix#

Read both shapes: jq '(.results[0].median // .results[0].summary.time_wall_clock.median) * 1000 | floor' out.json. Choose the shell with the long form: hyperfine --shell=default "cmd < input > /dev/null".

Evidence#

scripts/hook-bench.sh in rvow on 2026-10-22 with hyperfine 2.0.0: both fixes made the script print medians and exit 0.

Also found by searching

  • jq: error: null (null) and number (1000) cannot be multiplied
  • hyperfine export-json median is null
  • contains unquoted shell syntax ('<'). Explicitly choose how to execute it