Thread 'main' panicked at 'assertion failed: index < len', src/liballoc/


I’m trying to run an app developed with actix-web and rustls but I get panic:

thread 'main' panicked at 'assertion failed: index < len', src/liballoc/

maybe I created the cert wrong:

openssl genrsa 2048 &gt; key.pem

openssl req -x509 -days 1000 -new -key key.pem -out cert.pem

This is my file

I think maybe the issue is regarding with rustls.


Libraries aren’t supposed to panic on out-of-bounds vec access, so that’s a bug in one of them.

Try enabling full backtrace and see which library panics, and file an issue.

1 Like

Hello @kornel, thanks for you answer. Enabling backtrace I get this:

   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/
             at src/libstd/
   3: std::panicking::default_hook
             at src/libstd/
   4: std::panicking::rust_panic_with_hook
             at src/libstd/
   5: std::panicking::continue_panic_fmt
             at src/libstd/
   6: rust_begin_unwind
             at src/libstd/
   7: core::panicking::panic_fmt
             at src/libcore/
   8: core::panicking::panic
             at src/libcore/
   9: gloria_kwok_api::main
  10: std::rt::lang_start::{{closure}}
  11: std::panicking::try::do_call
             at src/libstd/
             at src/libstd/
  12: __rust_maybe_catch_panic
             at src/libpanic_unwind/
  13: std::rt::lang_start_internal
             at src/libstd/
             at src/libstd/
             at src/libstd/
  14: main
  15: __libc_start_main
  16: _start

also I will debug the app to figure out where exactly break

let mut keys = rsa_private_keys(key_file).unwrap();
config.set_single_cert(cert_chain, keys.remove(0)).unwrap();
graphql_config.set_single_cert(cert_chain_graphql, keys.remove(0)).unwrap();

Are config and graphql_config supposed to receive different keys or the same key?


I fixed the problem. It is because both were reading from the same buffer. Thanks!