dbt-labs/dbt-core · error

thread should not have failed

Error message

thread should not have failed

What it means

Test-only assertion in the AtomicOption concurrency stress test: joining a spawned worker thread must not have panicked. Fires only if concurrent store/load of the AtomicOption panics inside the worker (a real concurrency bug), surfacing the panic here via JoinHandle.

Solutions

  1. Inspect the propagated thread panic for the failing assertion in AtomicOption usage
  2. Run the stress test single-threaded to isolate the race
  3. Treat failure as a concurrency bug in AtomicOption, not flaky infrastructure
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-common/src/atomic.rs:117 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/8b9e72b7a5f6648b. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-common/src/atomic.rs:117

                let thread = std::thread::spawn(move || {
                    let inner_r = Arc::new(123);

                    std::thread::sleep(std::time::Duration::from_millis(100));
                    if i % 2 == 0 {
                        r.store(None);
                    }
                    r.store(Some(inner_r));
                    if let Some(value) = r.load() {
                        assert_eq!(Arc::new(123), value)
                    }
                    std::thread::sleep(std::time::Duration::from_millis(100));
                    r.store(None);
                });
                threads.push(thread);
            }

            for thread in threads {
                thread.join().expect("thread should not have failed")
            }
        }

        let value = r.load();
        assert!(value.is_none());
    }
}

View on GitHub (pinned to 0267ce9170)