The first crash report outl ever received was the crash reporter
OUTL-1, the first production event from outl's new crash reporting, says `failed printing to stderr: Broken pipe (os error 32)` and every frame in its stack is `<unknown>`. It is not a report of a crash in outl. Rust ignores SIGPIPE, so a write to a closed stderr returns EPIPE; tracing-subscriber reports that failed write with eprintln!, which panics; Sentry's panic integration then calls the previous hook, which is the default eprintln! hook, which panics again and aborts. The stored event is the abort. The frames were unnamed for a separate reason: the Linux job stripped at link time and offered sentry-cli a .dwp it does not accept, and the symbols that did upload went to a different Sentry project than the one the issue lives in. PR #406 is the writer, the hook, the kind check (ErrorKind::BrokenPipe, never errno 32, because Windows 32 is ERROR_SHARING_VIOLATION), and a Linux release job reordered so the symbols are read before the strip.
OUTL-1 is a fatal panic that reads failed printing to stderr: Broken pipe (os error 32).
It came from desktop@0.13.0-beta.260 on Linux x86_64, the first production event the new crash reporter ever delivered. Every frame in the stack arrived as <unknown>.
It is not a report of a crash in outl. It is outl crashing while reporting a crash, filed against a build whose symbols had been thrown away before anything could upload them.
three prints, and each one is the previous one’s error report
Rust ignores SIGPIPE. The runtime sets the disposition to SIG_IGN before main, so writing to a closed stderr does not kill the process the way it would in C. The write returns EPIPE, errno 32 on Linux. The print! family has nowhere to put that error, so it panics, and the message it panics with is the exact string in OUTL-1. That sentence is std’s, not ours.
From there it is three prints, in order, each one triggered by the failure of the one before it.
The first is a log line. A desktop launched with no terminal, whose stderr is a pipe nobody is reading any more, gets EPIPE the moment the tracing subscriber writes. The fmt layer notices the failed write and reports it, and the way tracing-subscriber reports an internal error is eprintln!, to the same closed pipe. That is the second print, and that is the one that panics.
The third is the panic hook. Sentry’s panic integration captures the event and then calls whatever hook was installed before it, which at that point was Rust’s default hook. The default hook prints with eprintln!. Same pipe, same EPIPE, a panic raised while a panic is already unwinding, and the process aborts.
The event Sentry stored is that abort. There was no bug underneath it. A pipe had closed, the app died on its first log line, and the stack that reached the dashboard described the printer.
the writer absorbs it, and the flag is the second lock on the same door
The fix at the bottom of the stack is a writer that reports a broken pipe as a finished write. It lives in crates/outl-telemetry/src/stdio.rs:
impl Write for LossyStderr {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
absorb_broken_pipe(io::stderr().write(buf), buf.len())
}
fn flush(&mut self) -> io::Result<()> {
match io::stderr().flush() {
Err(err) if is_broken_pipe(&err) => Ok(()),
other => other,
}
}
}
Every caller passes it with one more thing: .log_internal_errors(false). That looks redundant, since the writer never hands the layer an Err to report. It is not. The writer keeps the fmt layer from seeing a failure; the flag keeps the layer from printing one if some future change to the writer ever lets one through. Two independent things have to break before eprintln! is back on this path.
Four call sites take both: the desktop and mobile run() functions, the CLI’s init_tracing in crates/outl-cli/src/startup.rs, and the test. The TUI’s subscriber writes to a file rather than stderr, so it does not need either.
the kind is the whole check, because Windows 32 is a sharing violation
The first version of is_broken_pipe matched on the raw OS error number, because the panic message says os error 32 and 32 is EPIPE. Review caught it, and the commit that fixes it is in this PR under its own message. The function now reads:
fn is_broken_pipe(err: &io::Error) -> bool {
// The kind is the whole check. Unix `EPIPE` (errno 32) and Windows
// `ERROR_BROKEN_PIPE` (109) / `ERROR_NO_DATA` (232) all arrive as
// `ErrorKind::BrokenPipe`. Windows error 32 is `ERROR_SHARING_VIOLATION`,
// and matching the number would hide a real sharing failure.
err.kind() == io::ErrorKind::BrokenPipe
}
Thirty-two is EPIPE on Unix and ERROR_SHARING_VIOLATION on Windows, which is a file held open by another process. A number check would have turned every Windows sharing failure into a write this code quietly discards, on a client that writes markdown files for a living. The kind covers all three codes and cannot make that trade. The test asserts both halves per platform: on Unix that from_raw_os_error(32) has kind BrokenPipe, on Windows that it does not and that 109 and 232 do.
This is the shape of mistake worth naming. The symptom hands you a number, the number is in the panic message, and the number is right on the platform you are debugging on. Taking it is the obvious move and it is wrong on the platform you are not looking at.
the hook does not chain, and the TUI chains to it
The hook at the top of the stack has to write the panic without using the macro that panics:
fn write_panic(
mut out: impl Write,
info: &std::panic::PanicHookInfo<'_>,
backtrace: &std::backtrace::Backtrace,
) -> io::Result<()> {
let thread = std::thread::current();
let name = thread.name().unwrap_or("<unnamed>");
writeln!(out, "thread '{name}' {info}")?;
if backtrace.status() == std::backtrace::BacktraceStatus::Captured {
writeln!(out, "stack backtrace:\n{backtrace}")?;
}
Ok(())
}
writeln! returns the error instead of panicking on it, and the caller discards it. Three details carry weight. The thread name stays, because a panic report that cannot say which thread died is a worse report than one that is a line longer. Backtrace::capture is a no-op unless RUST_BACKTRACE is set to something other than 0, which is the same switch the default hook reads, so the variable still decides. And the capture happens before io::stderr().lock(), because a backtrace implementation that itself writes to stderr would otherwise deadlock on the lock the hook is holding.
The hook deliberately does not call the previous one. Chaining is the normal courtesy and here it would put eprintln! straight back on the path this exists to clear. That inverts an ordering somewhere else: the TUI installs a hook that restores the terminal out of raw mode, and that one does chain, so it has to be installed after outl_telemetry::init, not before. crates/outl-tui/src/runtime/terminal.rs now says so in the doc comment, because the failure mode if someone swaps the two lines is a user staring at a garbled terminal with no cursor and no way to know why.
init installs the hook before the gate that decides whether anything is reported, including on the path where that gate returns None. A build with no DSN, a user who opted out and a CI run all panic the same way; none of them should abort over a closed pipe.
SIGPIPE stays ignored, even though restoring it would delete the whole problem
There is a one-line version of this fix. Restore SIGPIPE to its default disposition and a write to a closed pipe kills the process outright, before any of this can run. No EPIPE, no panic, no hook, no chain.
It is also exactly wrong for a GUI. A desktop app whose log pipe went away would be killed by a signal mid-session, with an open workspace, for no reason the user could see. So both GUI binaries repeat the runtime’s own choice as the first statement of run():
#[cfg(unix)]
fn ignore_sigpipe() {
// SAFETY: `signal` is async-signal-safe. `SIG_IGN` is a valid disposition
// and does not run user code. The return value is the previous disposition;
// `SIG_ERR` is the only failure, and leaving the runtime's existing
// `SIG_IGN` in place is the outcome we already wanted.
unsafe {
let _ = libc::signal(libc::SIGPIPE, libc::SIG_IGN);
}
}
Rust already did this. The call is there because a library can undo it, and a library that restores the default disposition turns the next write to a closed pipe into a kill. Pinning it before anything writes means the write path is the only thing that has to tolerate EPIPE, and the write path is lossy_stderr.
fern retries on stderr, which is the same closed pipe
The desktop has a second logger. tauri-plugin-log writes to stdout, the webview console and a rotating file, and its TargetKind::Stdout is fern’s stdout logger, which writes with write!, retries on stderr when that fails, and panics if the retry fails too. A desktop with no terminal has both ends closed, so the retry is a second attempt at the same shut pipe.
crates/outl-desktop/src-tauri/src/log_target.rs replaces it with a dispatch that does not retry:
fn emit_stdout_line(out: &mut dyn Write, record: &log::Record) {
let _ = writeln!(out, "{}", record.args());
}
The non-obvious part is record.args(). The dispatch has no formatter of its own, because the plugin’s parent dispatch has already formatted the line as [date][time][target][LEVEL] message. Printing the args unchanged is what keeps that; rebuilding the line from the level and the original message would silently drop the timestamp. There is a test that asserts the captured line is exactly [2026-10-20][16:42:00][outl_desktop][INFO] hello, which is the only way that stays true.
the test spawns itself, because the exit code is the only honest assertion
crates/outl-telemetry/tests/closed_stderr.rs is 143 lines and declares harness = false in the manifest, since libtest would capture the very stdout the child needs to speak on.
The child prints READY to stdout and blocks on stdin. The parent reads the signal, drops the read end of the child’s stderr, then releases it. The child installs the same two things the binaries do, logs a line, and panics on purpose.
let _guard = outl_telemetry::init("test", false);
let subscriber = tracing_subscriber::fmt()
.with_max_level(tracing::Level::TRACE)
.with_writer(outl_telemetry::lossy_stderr)
.log_internal_errors(false)
.finish();
Exit 0 is the entire assertion, and it is the right one because every failure mode has a distinct exit. A printer panic leaves 101. A hook that panics again aborts. catch_unwind hides neither, which is why the child wraps its deliberate panic in one and still cannot cheat.
A second child covers the opposite direction, which matters more than it looks. It runs with stderr open and RUST_BACKTRACE=1, and asserts the output contains thread 'main', the panic message, and stack backtrace:. Without it, a hook that wrote nothing at all would pass the first test perfectly.
the frames were unnamed for two reasons, and the strip was only one
A report that survives is still useless if every frame is <unknown>, and the two causes of that were independent.
The Linux job threw the DWARF away before anything could read it. [profile.release] sets split-debuginfo = "packed", which on Linux writes a .dwp file. sentry-cli debug-files upload accepts ELF, dSYM, PDB, Breakpad and WASM; a DWARF package is not on that list. The job also stripped at link time, so the ELF that would have been an acceptable input had nothing left in it.
The Linux desktop job now compiles with CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO: "off" and no link-time strip, so the DWARF stays inside target/release/outl-desktop. Then it checks:
if ! readelf -S "${BIN}" | grep -q '\.debug_info'; then
and only then uploads the ELF, strips it, and runs tauri bundle for the deb, AppImage and rpm. The ordering is the fix: the file sentry-cli reads and the file users download are the same binary at two different moments. [profile.release] itself is untouched, still debug = "line-tables-only" and split-debuginfo = "packed", so only this one job sees the override and every other build is unaffected.
The symbols that did upload went to the wrong project. They were being sent to outl-desktop, while OUTL-1 is an issue id in the project named outl. All three desktop jobs now target org outl, project outl, and create the release desktop@<version>, which is the string the binary actually reports: start builds it as format!("{client}@{}", env!("CARGO_PKG_VERSION")). macOS uploads its .dSYM, Windows its .pdb and .exe, Linux the ELF, all with --include-sources so a frame resolves to a line of source rather than to mod.rs:42 with no body. The CLI stays on outl-cli and mobile on outl-mobile, because their events are not this issue.
After the bundle step the artifacts go through scripts/check-artifact-stripped.py, the gate that opens every published file rather than trusting the step order. It is the same script that grew a rule for runner variable names after a dependency compiled our CI environment into every binary we shipped. Moving a strip out of a profile and into a job is precisely the change that gate exists to catch.
what this does not cover
The CLI’s own output still panics on a closed stdout. println! in outl export md or outl page list is the program’s output, not logging, and rewriting it was left out of this change on purpose. So outl export md | head -5 can still die with failed printing to stdout. The CLI’s subscriber and the interactive Initialize a new workspace here? [y/N] prompt no longer use eprintln!; the data the user asked for does.
A log line written to a closed stderr is now gone, and nothing counts them. That is the trade the writer makes, and it is the right one for a line nobody can read, but there is no metric that would tell me if it started happening constantly.
The symbol pipeline is still first exercised by a release. The dry run on this branch went green all the way through: tauri build --no-bundle, the readelf gate, the upload script, the strip, and the strip gate on all three bundles, on Linux, macOS and Windows. It proved nothing about Sentry. SENTRY_AUTH_TOKEN is a secret of the release GitHub Environment, and the deployment branch policy only admits main and v* tags, so on a branch the token is empty, the script warns, and releases new and debug-files upload never open a connection. The half of OUTL-1 that produced <unknown> frames gets its first real run on the next tag.
A missing token warns and the release continues. That is deliberate, because a release must not block on a third party being up, and a version tag that produced no debug file at all still fails the job. The price is a green release that ships with no symbols and says so only in a line of the job summary. If the secret is ever removed from that environment, crashes from every build after it arrive as bare addresses, and nothing goes red.
The lesson is not that crash reporters are hard to write. It is that the error path of your error path is production code, and it is the one piece of code whose working conditions are guaranteed to be the conditions under which everything else has already failed. Every print a reporter makes, it makes while something is broken enough to have reached the reporter. The second half of the same lesson is the pipeline: a build step that only runs on a release tag is untested code with a green checkmark next to it, and when it fails it does not say “no symbols”, it says <unknown>.
The fix is in outl PR #406: crates/outl-telemetry/src/stdio.rs, crates/outl-desktop/src-tauri/src/log_target.rs, and the three desktop jobs in .github/workflows/release.yml.