How to interpret backtrace generated by a panic?

Hi community, I came across a panic on macOS recently, and was able to show the following stack trace after setting RUST_BACKTRACE to 1:

thread 'main' panicked at 'a Display implementation returned an error unexpectedly: Error', /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/string.rs:2481:14
stack backtrace:
   0:     0x7f950992163d - std::backtrace_rs::backtrace::libunwind::trace::hc5376e1f9e4c14fa
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f950992163d - std::backtrace_rs::backtrace::trace_unsynchronized::hd15c3fc9f4947abd
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f950992163d - std::sys_common::backtrace::_print_fmt::ha8075890ce48b75c
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f950992163d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc0b18c49c3f409e9
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f9509962fcc - core::fmt::write::h5f97ce7fceb49c8e
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/fmt/mod.rs:1196:17
   5:     0x7f950991ad01 - std::io::Write::write_fmt::h92643d786d6b0c5a
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/io/mod.rs:1654:15
   6:     0x7f9509922fb5 - std::sys_common::backtrace::_print::hbcbdbbe490a4940a
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f9509922fb5 - std::sys_common::backtrace::print::h099f7bb689415e9c
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f9509922fb5 - std::panicking::default_hook::{{closure}}::hb730f576b7ac56c9
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:295:22
   9:     0x7f9509922c29 - std::panicking::default_hook::hed6832fe5378b865
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:314:9
  10:     0x7f9509923588 - std::panicking::rust_panic_with_hook::h2727878cd2386357
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:698:17
  11:     0x7f9509923437 - std::panicking::begin_panic_handler::{{closure}}::hb832e69bd7fe3dc1
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:588:13
  12:     0x7f9509921af4 - std::sys_common::backtrace::__rust_end_short_backtrace::h3509025fa7911dd3
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x7f9509923169 - rust_begin_unwind
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
  14:     0x7f9508f112c3 - core::panicking::panic_fmt::h5d9da573c785c98d
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
  15:     0x7f9508f113b3 - core::result::unwrap_failed::h5add418f3f316ef8
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
  16:     0x7f95092e70dc - <T as alloc::string::ToString>::to_string::h10ce53e41595dd2e
  17:     0x7f95092fee9f - <pact_models::generators::Generator as pact_models::generators::GenerateValue<serde_json::value::Value>>::generate_value::heaa3cc6d06aaf52e
  18:     0x7f95093036eb - <pact_models::generators::JsonHandler as pact_models::generators::ContentTypeHandler<serde_json::value::Value>>::apply_key::h5368e108799e47ca
  19:     0x7f9509302a37 - <pact_models::generators::JsonHandler as pact_models::generators::ContentTypeHandler<serde_json::value::Value>>::process_body::h50e08841a9c5747c
  20:     0x7f9508f6617b - pact_matching::generators::generators_process_body::{{closure}}::hf7642ae79655ad62
  21:     0x7f9508f86f58 - pact_verifier::verify_response_from_provider::{{closure}}::h2adbec90847b61b9
  22:     0x7f9508fc952d - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hc3bca0a640d66bf0
  23:     0x7f9508fbad3c - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h30bd2f059538cc85
  24:     0x7f9508f54475 - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::h148baf817e15a568
  25:     0x7f9508fbc352 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h4823e06f176ee40b
  26:     0x7f9508f47b18 - <futures_util::stream::stream::then::Then<St,Fut,F> as futures_core::stream::Stream>::poll_next::hd657b7269c813dd0
  27:     0x7f95090211dc - <futures_util::stream::stream::collect::Collect<St,C> as core::future::future::Future>::poll::h3e98278371acac25
  28:     0x7f9508f8098f - pact_verifier::verify_provider_async::{{closure}}::{{closure}}::h6dad783c66e5cc53
  29:     0x7f9508fd62d0 - <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll::h23d8950899588a33
  30:     0x7f9508fce36a - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hdf98dfd50c5ce2b4
  31:     0x7f9508f542d5 - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::h0d719edb8530cd18
  32:     0x7f9508fd4c80 - pact_verifier_cli::handle_cli::{{closure}}::hfd5cc15d506a3c56
  33:     0x7f9508fcbd10 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hcdcbcec9b78766ff
  34:     0x7f9508fd935e - std::thread::local::LocalKey<T>::with::h7c545d0a26d660fc
  35:     0x7f9508f3dcef - tokio::park::thread::CachedParkThread::block_on::h0f0a115e08041f1e
  36:     0x7f95090205b4 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::hdfa231122ae4b4d8
  37:     0x7f9508feb79a - pact_verifier_cli::main::hafaa89afa28664f8
  38:     0x7f9508f2d353 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5ee6ba657c274c8b
  39:     0x7f9508fd7719 - std::rt::lang_start::{{closure}}::h80c5fbaa8c265070
  40:     0x7f95099150e1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h18fd15a330c116b9
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:280:13
  41:     0x7f95099150e1 - std::panicking::try::do_call::he918a328b783a420
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492:40
  42:     0x7f95099150e1 - std::panicking::try::h88ecc043ee71c652
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456:19
  43:     0x7f95099150e1 - std::panic::catch_unwind::h074c8fe23976f009
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137:14
  44:     0x7f95099150e1 - std::rt::lang_start_internal::{{closure}}::he26a080dffc4764a
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128:48
  45:     0x7f95099150e1 - std::panicking::try::do_call::hf9be9f327f382512
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492:40
  46:     0x7f95099150e1 - std::panicking::try::h163c4b2413cf9165
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456:19
  47:     0x7f95099150e1 - std::panic::catch_unwind::h58a40b305e945d4e
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137:14
  48:     0x7f95099150e1 - std::rt::lang_start_internal::h183e60933887f95a
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128:20
  49:     0x7f9508fec572 - main

How should I interpret this backtrace? Specifically

  1. What's the root cause for this panic? Calling "to_string"?
  2. How to interpret <T as alloc::string::ToString>::to_string? Does "as" mean a type casting?
  3. What are those strings start with an "h" e.g., "h183e60933887f95a"?
  4. Could you please provide links to official doc and/or Rust source code to support your answers?

Thanks in advance!

The root cause is a panic from a panic inside to_string().

This is fully qualified syntax, referring to the to_string() method in the implementation of the ToString trait for the type T. Usually, an actual type would be in the place of T; in this case, it's named as a generic parameter since it's referring to a blanket impl for types implementing Display:

impl<T: fmt::Display + ?Sized> ToString for T {
    // A common guideline is to not inline generic functions. However,
    // removing `#[inline]` from this method causes non-negligible regressions.
    // See <https://github.com/rust-lang/rust/pull/74852>, the last attempt
    // to try to remove it.
    #[inline]
    default fn to_string(&self) -> String {
        let mut buf = String::new();
        let mut formatter = core::fmt::Formatter::new(&mut buf);
        // Bypass format_args!() to avoid write_str with zero-length strs
        fmt::Display::fmt(self, &mut formatter)
            .expect("a Display implementation returned an error unexpectedly");
        buf
    }
}

Here, we see the Result::expect() call that is generating the panic. It's saying that the Display impl for whatever is being converted to a string unexpectedly returned an Err. Now, looking at the source for the generate_value() method which calls to_string(), we see several possible culprits.

Are you able to reproduce this panic on a debug build? That would let the backtrace include the file and line number of the to_string() call that is causing the panic.

These are symbol hashes, added to disambiguate different versions of a function with different generic parameters, as well as to differentiate the same function in different versions of a crate.

1 Like

Wow, thanks a lot for your answer!

And yes, I was able to reproduce this panic on a debug build, which produced the following backtrace:

thread 'main' panicked at 'a Display implementation returned an error unexpectedly: Error', /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/string.rs:2490:14
stack backtrace:
   0:        0x10e89a044 - std::backtrace_rs::backtrace::libunwind::trace::h0934ce8016da62ea
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x10e89a044 - std::backtrace_rs::backtrace::trace_unsynchronized::h59c3dee870344ec2
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x10e89a044 - std::sys_common::backtrace::_print_fmt::h498b4033e357b134
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:66:5
   3:        0x10e89a044 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7d80e14dd19335c9
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:45:22
   4:        0x10e8ba42b - core::fmt::write::h1709d0255080e28a
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/fmt/mod.rs:1198:17
   5:        0x10e8937c8 - std::io::Write::write_fmt::hecc56b5639d319e7
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/io/mod.rs:1672:15
   6:        0x10e89b95d - std::sys_common::backtrace::_print::h6f0d53db9de204c5
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:48:5
   7:        0x10e89b95d - std::sys_common::backtrace::print::h33928b4e9b284b1e
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:35:9
   8:        0x10e89b95d - std::panicking::default_hook::{{closure}}::had4d1cd22a173020
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:295:22
   9:        0x10e89b6ae - std::panicking::default_hook::h42aa124509888735
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:314:9
  10:        0x10e89be98 - std::panicking::rust_panic_with_hook::h2b231e816574a23a
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:698:17
  11:        0x10e89bdd3 - std::panicking::begin_panic_handler::{{closure}}::h9da8d88b7a4c9d5e
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:588:13
  12:        0x10e89a4c7 - std::sys_common::backtrace::__rust_end_short_backtrace::h10dbf1377dfaf877
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:138:18
  13:        0x10e89baaa - rust_begin_unwind
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
  14:        0x10e8f47b3 - core::panicking::panic_fmt::hde1544b10dc8b4d3
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
  15:        0x10e8f4915 - core::result::unwrap_failed::h0a3d20f5459baffe
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/result.rs:1814:5
  16:        0x10e635c44 - core::result::Result<T,E>::expect::he374246a5082fd3d
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/result.rs:1064:23
  17:        0x10da71635 - <T as alloc::string::ToString>::to_string::hbd9ea0180819e6e4
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/string.rs:2489:9
  18:        0x10dc00b56 - <pact_models::generators::Generator as pact_models::generators::GenerateValue<serde_json::value::Value>>::generate_value::hd9058cd40dee4bcd
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/pact_models-1.0.1/src/generators/mod.rs:1264:24
  19:        0x10dc0518d - <pact_models::generators::JsonHandler as pact_models::generators::ContentTypeHandler<serde_json::value::Value>>::apply_key::ha03b9cc2b8fdf370
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/pact_models-1.0.1/src/generators/mod.rs:1476:37
  20:        0x10dc048b8 - <pact_models::generators::JsonHandler as pact_models::generators::ContentTypeHandler<serde_json::value::Value>>::process_body::h1218e8ecc7f95a6d
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/pact_models-1.0.1/src/generators/mod.rs:1445:9
  21:        0x10d1160ef - pact_matching::generators::generators_process_body::{{closure}}::h31220800d6825a4e
                               at /Users/jerry.wang/pact-reference/rust/pact_matching/src/generators.rs:65:14
  22:        0x10d10cf07 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h40334db293e6359b
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  23:        0x10d196704 - pact_matching::generate_request::{{closure}}::ha4113a3cdd913faa
                               at /Users/jerry.wang/pact-reference/rust/pact_matching/src/lib.rs:1799:82
  24:        0x10d10d7e7 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h551315c82dfda646
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  25:        0x10d0dc022 - pact_verifier::verify_response_from_provider::{{closure}}::h9877dda4de8265ba
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier/src/lib.rs:312:57
  26:        0x10d10d367 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h48a854da5a415ee1
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  27:        0x10d0d6f6a - pact_verifier::verify_v3_interaction::{{closure}}::h45fea097a8c0ba3f
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier/src/lib.rs:529:78
  28:        0x10d110237 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf9b9fa9fa07e8684
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  29:        0x10d0c7c6e - pact_verifier::verify_interaction::{{closure}}::h80ee265a77569cab
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier/src/lib.rs:405:100
  30:        0x10d10f0b7 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hc47bbe3125daa357
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  31:        0x10d16062e - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::h15e3c88e260e562a
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-0.1.37/src/instrument.rs:272:9
  32:        0x10d0cde6e - pact_verifier::verify_pact_internal::{{closure}}::{{closure}}::{{closure}}::ha09e8befd843c5e5
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier/src/lib.rs:1238:96
  33:        0x10d10ea27 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h9a263671d9082f6c
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  34:        0x10d20e9a4 - <futures_util::stream::stream::then::Then<St,Fut,F> as futures_core::stream::Stream>::poll_next::he0e372d3da3dbf1a
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.25/src/stream/stream/then.rs:69:35
  35:        0x10d1a0b6c - <futures_util::stream::stream::collect::Collect<St,C> as core::future::future::Future>::poll::h7517f2b9672dec9b
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.25/src/stream/stream/collect.rs:50:26
  36:        0x10d0cb26c - pact_verifier::verify_pact_internal::{{closure}}::h45e671e3c78c3773
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier/src/lib.rs:1240:15
  37:        0x10d10dcd7 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h5eeb4203c4243d05
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  38:        0x10d0d39bb - pact_verifier::verify_provider_async::{{closure}}::{{closure}}::h5b70da8ef21ab1bd
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier/src/lib.rs:936:14
  39:        0x10d10d487 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h4bc81913dfa1e69a
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  40:        0x10d1cf85f - <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll::{{closure}}::h10ed70110148349b
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/task/task_local.rs:348:35
  41:        0x10d1cfde0 - tokio::task::task_local::LocalKey<T>::scope_inner::h65b8f7642d2b0345
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/task/task_local.rs:233:19
  42:        0x10d1cf6ef - <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll::hb9be4bdb88bb9280
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/task/task_local.rs:345:13
  43:        0x10d0ceb4d - pact_verifier::verify_provider_async::{{closure}}::h5a168de0dcce414c
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier/src/lib.rs:1042:5
  44:        0x10d10d247 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h463ec61644ab193f
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  45:        0x10d16083e - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::hbd62d2544c32a3d6
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-0.1.37/src/instrument.rs:272:9
  46:        0x10d14e63f - pact_verifier_cli::handle_matches::{{closure}}::h79d2fcdedb5b43dd
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier_cli/src/main.rs:450:87
  47:        0x10d110430 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hff73d5413f103692
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  48:        0x10d14b407 - pact_verifier_cli::handle_cli::{{closure}}::h206de5e0c180c6bf
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier_cli/src/main.rs:348:44
  49:        0x10d10fad0 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hdf4677d307991909
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  50:        0x10d1512cf - pact_verifier_cli::main::{{closure}}::hbdcc256871246266
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier_cli/src/main.rs:603:52
  51:        0x10d10cad0 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1df0505bd4332cba
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  52:        0x10d0f851a - tokio::runtime::park::CachedParkThread::block_on::{{closure}}::had296ec6bca9c200
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/runtime/park.rs:272:63
  53:        0x10d0f7eba - tokio::runtime::coop::with_budget::hbd2d7dbd93d606e8
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/runtime/coop.rs:102:5
  54:        0x10d0f7eba - tokio::runtime::coop::budget::h0ddfc055d61c1afa
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/runtime/coop.rs:68:5
  55:        0x10d0f7eba - tokio::runtime::park::CachedParkThread::block_on::h421c42ff88316e1b
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/runtime/park.rs:272:31
  56:        0x10d1d859e - tokio::runtime::context::BlockingRegionGuard::block_on::h711dab1ba999f3cc
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/runtime/context.rs:255:13
  57:        0x10d0949ce - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::h322a68a1214546d6
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/runtime/scheduler/multi_thread/mod.rs:66:9
  58:        0x10d1d036a - tokio::runtime::runtime::Runtime::block_on::he7a5ca7e43e13373
                               at /Users/jerry.wang/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.22.0/src/runtime/runtime.rs:281:45
  59:        0x10d1a03ce - pact_verifier_cli::main::hbe6ad281e082a183
                               at /Users/jerry.wang/pact-reference/rust/pact_verifier_cli/src/main.rs:602:16
  60:        0x10d0e4c6e - core::ops::function::FnOnce::call_once::h9f8aabdc60347e60
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
  61:        0x10d1dae21 - std::sys_common::backtrace::__rust_begin_short_backtrace::h165948dfe85c04af
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:122:18
  62:        0x10d0a25d4 - std::rt::lang_start::{{closure}}::hba7781b10c17c56b
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/rt.rs:145:18
  63:        0x10e88d9bb - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::ha6b934dd2f7d5008
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:280:13
  64:        0x10e88d9bb - std::panicking::try::do_call::h5a3f4b34abdbdae8
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:492:40
  65:        0x10e88d9bb - std::panicking::try::h56b1848524fc332f
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:456:19
  66:        0x10e88d9bb - std::panic::catch_unwind::h44afff85dd6d04a7
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panic.rs:137:14
  67:        0x10e88d9bb - std::rt::lang_start_internal::{{closure}}::hd7c11497b2582199
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/rt.rs:128:48
  68:        0x10e88d9bb - std::panicking::try::do_call::h2353d56408689f1d
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:492:40
  69:        0x10e88d9bb - std::panicking::try::h58a401d784e0ca5d
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:456:19
  70:        0x10e88d9bb - std::panic::catch_unwind::h35fff46a669b8467
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panic.rs:137:14
  71:        0x10e88d9bb - std::rt::lang_start_internal::h18b571735d69908e
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/rt.rs:128:20
  72:        0x10d0a25ae - std::rt::lang_start::h248788b8e5f8daf5
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/rt.rs:144:17
  73:        0x10d1a0516 - _main
  74:     0x7ff805909310 - <unknown>

So it looks the culprit is part of the Generator::Date branch.

How are you invoking pact_verifier_cli? It looks like this panic is caused whenever a "date" matcher rule is used with time formatting characters (such as HH:mm:ss).

With a bunch of command line options, of course. But the root cause is that there is a pact (JSON) file, in which there is an offending object looks like the following:

      "generators": {
          "body": {
            "$.DateCreated": {
              "format": "yyyy-MM-dd'T'HH:mm:ss.SSSX",
              "type": "Date"
             },
           ...

As you guessed, there is a mismatch between the type "Date" and the format string ""yyyy-MM-dd'T'HH:mm:ss.SSSX" (which is for a "DateTime").

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.