Skip to content

Panic caused by StateScoped entities with avian components #676

@alec-deason

Description

@alec-deason

When I have an entity with avian components and also StateScoped I'm seeing a panic when transitioning states away from the one the entity is scoped to. I'm using bevy 0.16-rc.1 and avian2d main to test out avian's 0.16 transition. This panic did not occur before the 0.16 transition.

Minimal example:

 use avian2d::prelude::*;
 use bevy::prelude::*;

 fn main() {
     App::new()
         .add_plugins((
             DefaultPlugins,
             PhysicsPlugins::default().with_length_unit(20.0),
         ))
         .add_systems(Startup, setup)
         .add_systems(Update, next_state.run_if(in_state(State::Run)))
         .init_state::<State>()
         .enable_state_scoped_entities::<State>()
         .run();
 }

 #[derive(States, Debug, Hash, PartialEq, Eq, Clone, Default)]
 enum State {
     #[default]
     Run,
     Done,
 }

 fn setup(mut commands: Commands) {
     commands.spawn((
         RigidBody::Dynamic,
         Collider::circle(10.0),
         StateScoped(State::Run),
     ));
 }

 fn next_state(mut next: ResMut<NextState<State>>) {
     next.set(State::Done);
 }


The panic and error logs look like this:


Encountered an error in command `<<avian2d::collision::collider::collider_hierarchy::ColliderOf as bevy_ecs::relationship::Relationship>::on_replace::{{closure}} as bevy_ecs::error::command_handling::CommandWithEntity<core::result::Result<(), bevy_ecs::world::error::EntityMutableFetchError>>>::with_entity::{{closure}}`: EntityDoesNotExist(EntityDoesNotExistError { entity: 16v1#4294967312, details: EntityDoesNotExistDetails { location: MaybeLocation { marker: PhantomData<core::option::Option<&core::panic::location::Location>> } } })
   1: <T as core::convert::Into<U>>::into
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:761:9
   2: <C as bevy_ecs::error::command_handling::HandleError<core::result::Result<T,E>>>::handle_error_with::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/error/command_handling.rs:36:17
   3: <F as bevy_ecs::system::commands::command::Command<Out>>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/command.rs:62:9
   4: bevy_ecs::world::command_queue::RawCommandQueue::push::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:173:25
   5: core::ops::function::FnOnce::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
   6: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:263:26
   7: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
   8: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
   9: __rust_try
  10: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  11: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  12: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:268:30
  13: bevy_ecs::world::World::flush_commands
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2901:17
  14: bevy_ecs::world::World::flush
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2924:9
  15: bevy_ecs::world::entity_ref::EntityWorldMut::despawn_with_caller
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/entity_ref.rs:2392:9
  16: bevy_ecs::system::commands::entity_command::despawn::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/entity_command.rs:213:9
  17: core::ops::function::FnOnce::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  18: <F as bevy_ecs::system::commands::entity_command::EntityCommand<Out>>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/entity_command.rs:102:9
  19: <C as bevy_ecs::error::command_handling::CommandWithEntity<core::result::Result<(),bevy_ecs::world::error::EntityMutableFetchError>>>::with_entity::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/error/command_handling.rs:86:13
  20: <F as bevy_ecs::system::commands::command::Command<Out>>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/command.rs:62:9
  21: <C as bevy_ecs::error::command_handling::HandleError<core::result::Result<T,E>>>::handle_error_with::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/error/command_handling.rs:33:40
  22: <F as bevy_ecs::system::commands::command::Command<Out>>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/command.rs:62:9
  23: bevy_ecs::world::command_queue::RawCommandQueue::push::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:173:25
  24: core::ops::function::FnOnce::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  25: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:263:26
  26: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  27: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  28: __rust_try
  29: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  30: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  31: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:268:30
  32: bevy_ecs::world::command_queue::CommandQueue::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:94:13
  33: <bevy_ecs::world::command_queue::CommandQueue as bevy_ecs::system::system_param::SystemBuffer>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:326:9
  34: <bevy_ecs::system::system_param::Deferred<T> as bevy_ecs::system::system_param::SystemParam>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/system_param.rs:1405:9
  35: <(P0,P1) as bevy_ecs::system::system_param::SystemParam>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/system_param.rs:2024:19
  36: bevy_ecs::system::commands::_::<impl bevy_ecs::system::system_param::SystemParam for bevy_ecs::system::commands::Commands>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/mod.rs:158:13
  37: <(P0,P1,P2) as bevy_ecs::system::system_param::SystemParam>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/system_param.rs:2024:19
  38: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::apply_deferred
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/function_system.rs:840:9
  39: <bevy_ecs::system::schedule_system::InfallibleSystemWrapper<S> as bevy_ecs::system::system::System>::apply_deferred
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/schedule_system.rs:76:9
  40: bevy_ecs::schedule::executor::multi_threaded::apply_deferred::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/schedule/executor/multi_threaded.rs:744:13
  41: core::ops::function::FnOnce::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  42: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  43: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  44: __rust_try
  45: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  46: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  47: bevy_ecs::schedule::executor::multi_threaded::apply_deferred
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/schedule/executor/multi_threaded.rs:743:19
  48: bevy_ecs::schedule::executor::multi_threaded::ExecutorState::spawn_exclusive_system_task::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/schedule/executor/multi_threaded.rs:658:27
  49: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::future::future::Future>::poll
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:297:9
  50: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:656:42
  51: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  52: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  53: __rust_try
  54: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  55: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  56: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:656:9
  57: async_executor::Executor::spawn_inner::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-executor-1.13.1/src/lib.rs:250:20
  58: async_task::raw::RawTask<F,T,S,M>::run::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-task-4.7.1/src/raw.rs:550:21
  59: core::ops::function::FnOnce::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  60: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  61: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  62: __rust_try
  63: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  64: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  65: async_task::raw::RawTask<F,T,S,M>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-task-4.7.1/src/raw.rs:549:23
  66: async_task::runnable::Runnable<M>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-task-4.7.1/src/runnable.rs:781:18
  67: async_executor::State::tick::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-executor-1.13.1/src/lib.rs:729:9
  68: async_executor::Executor::tick::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/async-executor-1.13.1/src/lib.rs:325:29
  69: bevy_tasks::thread_executor::ThreadExecutorTicker::tick::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/thread_executor.rs:104:39
  70: bevy_tasks::task_pool::TaskPool::execute_scope::{{closure}}::{{closure}}::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/task_pool.rs:542:45
  71: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::future::future::Future>::poll
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:297:9
  72: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:656:42
  73: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  74: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  75: __rust_try
  76: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  77: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  78: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:656:9
  79: bevy_tasks::task_pool::TaskPool::execute_scope::{{closure}}::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/task_pool.rs:545:77
  80: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:457:33
  81: bevy_tasks::task_pool::TaskPool::execute_scope::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/task_pool.rs:548:41
  82: bevy_tasks::task_pool::TaskPool::scope_with_executor_inner::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/task_pool.rs:459:85
  83: futures_lite::future::block_on::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:99:19
  84: std::thread::local::LocalKey<T>::try_with
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:310:12
  85: std::thread::local::LocalKey<T>::with
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:274:15
  86: futures_lite::future::block_on
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/future.rs:78:5
  87: bevy_tasks::task_pool::TaskPool::scope_with_executor_inner
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/task_pool.rs:413:13
  88: bevy_tasks::task_pool::TaskPool::scope_with_executor::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/task_pool.rs:343:17
  89: std::thread::local::LocalKey<T>::try_with
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:310:12
  90: std::thread::local::LocalKey<T>::with
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:274:15
  91: bevy_tasks::task_pool::TaskPool::scope_with_executor
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0-rc.1/src/task_pool.rs:339:9
  92: <bevy_ecs::schedule::executor::multi_threaded::MultiThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/schedule/executor/multi_threaded.rs:221:9
  93: bevy_ecs::schedule::schedule::Schedule::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/schedule/schedule.rs:446:9
  94: bevy_ecs::world::World::try_run_schedule::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:3631:55
  95: bevy_ecs::world::World::try_schedule_scope
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:3564:21
  96: bevy_ecs::world::World::try_run_schedule
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:3631:9
  97: bevy_app::main_schedule::Main::run_main::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_app-0.16.0-rc.1/src/main_schedule.rs:281:25
  98: bevy_ecs::world::World::try_resource_scope
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2738:22
  99: bevy_ecs::world::World::resource_scope
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2701:9
 100: bevy_app::main_schedule::Main::run_main
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_app-0.16.0-rc.1/src/main_schedule.rs:279:9
 101: core::ops::function::FnMut::call_mut
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
 102: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
 103: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn(F0) .> Out>>::run::call_inner
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:255:21
 104: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn(F0) .> Out>>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:258:17
 105: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_without_applying_deferred::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:133:23
 106: bevy_ecs::world::World::last_change_tick_scope
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:3087:9
 107: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_without_applying_deferred
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:125:9
 108: bevy_ecs::system::system::System::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/system.rs:86:19
 109: <bevy_ecs::system::schedule_system::InfallibleSystemWrapper<S> as bevy_ecs::system::system::System>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/schedule_system.rs:70:9
note: Some "noisy" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.

Encountered a panic when applying buffers for system `bevy_state::state_scoped::clear_state_scoped_entities<avian_example::State>`!
Encountered a panic in system `bevy_ecs::apply_deferred`!
2025-03-24T21:04:04.442547Z  WARN bevy_ecs::error::handler: Encountered an error in command `<bevy_ecs::system::commands::entity_command::remove<avian2d::collision::collider::collider_hierarchy::ColliderOf>::{{closure}} as bevy_ecs::error::command_handling::CommandWithEntity<core::result::Result<(), bevy_ecs::world::error::EntityMutableFetchError>>>::with_entity::{{closure}}`: EntityDoesNotExist(EntityDoesNotExistError { entity: 16v1#4294967312, details: EntityDoesNotExistDetails { location: MaybeLocation { marker: PhantomData<core::option::Option<&core::panic::location::Location>> } } })
   1: <T as core::convert::Into<U>>::into
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:761:9
   2: <C as bevy_ecs::error::command_handling::HandleError<core::result::Result<T,E>>>::handle_error_with::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/error/command_handling.rs:36:17
   3: <F as bevy_ecs::system::commands::command::Command<Out>>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/command.rs:62:9
   4: bevy_ecs::world::command_queue::RawCommandQueue::push::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:173:25
   5: core::ops::function::FnOnce::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
   6: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:263:26
   7: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
   8: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
   9: __rust_try
  10: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  11: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  12: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:268:30
  13: bevy_ecs::world::World::flush_commands
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2901:17
  14: bevy_ecs::world::World::flush
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2924:9
  15: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_without_applying_deferred::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:135:13
  16: bevy_ecs::world::World::last_change_tick_scope
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:3087:9
  17: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_without_applying_deferred
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:125:9
  18: bevy_ecs::system::system::System::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/system.rs:86:19
  19: <bevy_ecs::system::combinator::PipeSystem<A,B> as bevy_ecs::system::system::System>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/combinator.rs:421:9
  20: <bevy_ecs::system::schedule_system::InfallibleSystemWrapper<S> as bevy_ecs::system::system::System>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/schedule_system.rs:70:9
note: Some "noisy" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.

2025-03-24T21:04:04.443862Z  WARN bevy_ecs::error::handler: Encountered an error in command `<bevy_ecs::system::commands::entity_command::remove<avian2d::collision::collider::backend::ColliderMarker>::{{closure}}as bevy_ecs::error::command_handling::CommandWithEntity<core::result::Result<(), bevy_ecs::world::error::EntityMutableFetchError>>>::with_entity::{{closure}}`: EntityDoesNotExist(EntityDoesNotExistError { entity:16v1#4294967312, details: EntityDoesNotExistDetails { location: MaybeLocation { marker: PhantomData<core::option::Option<&core::panic::location::Location>> } } })
   1: <T as core::convert::Into<U>>::into
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:761:9
   2: <C as bevy_ecs::error::command_handling::HandleError<core::result::Result<T,E>>>::handle_error_with::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/error/command_handling.rs:36:17
   3: <F as bevy_ecs::system::commands::command::Command<Out>>::apply
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/commands/command.rs:62:9
   4: bevy_ecs::world::command_queue::RawCommandQueue::push::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:173:25
   5: core::ops::function::FnOnce::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
   6: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:263:26
   7: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
   8: std::panicking::try::do_call
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
   9: __rust_try
  10: std::panicking::try
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  11: std::panic::catch_unwind
             at /home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  12: bevy_ecs::world::command_queue::RawCommandQueue::apply_or_drop_queued
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/command_queue.rs:268:30
  13: bevy_ecs::world::World::flush_commands
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2901:17
  14: bevy_ecs::world::World::flush
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:2924:9
  15: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_without_applying_deferred::{{closure}}
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:135:13
  16: bevy_ecs::world::World::last_change_tick_scope
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/world/mod.rs:3087:9
  17: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_without_applying_deferred
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/exclusive_function_system.rs:125:9
  18: bevy_ecs::system::system::System::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/system.rs:86:19
  19: <bevy_ecs::system::combinator::PipeSystem<A,B> as bevy_ecs::system::system::System>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/combinator.rs:421:9
  20: <bevy_ecs::system::schedule_system::InfallibleSystemWrapper<S> as bevy_ecs::system::system::System>::run
             at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0-rc.1/src/system/schedule_system.rs:70:9
note: Some "noisy" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CollisionRelates to the broad phase, narrow phase, colliders, or other collision functionalityC-BugSomething isn't workingP-CrashA sudden unexpected crash

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions