Skip to content

[BUG] pyo3_async_runtimes.RustPanic: rust future panicked: unknown error #1059

@mollenhauer

Description

@mollenhauer

Describe the bug
Can't get cocoindex running on my M4 mac mini (keyword: Apple Silicone) to work at all:

cocoindex ls failes with an RustPanic

Any ideas?

Here are the minimal steps in an empty directory that reproduces the error on my machine:

❯ uv init

❯ uv add cocoindex
Resolved 16 packages in 10ms
Installed 14 packages in 18ms
 + anyio==4.11.0
 + click==8.3.0
 + cocoindex==0.2.14
 + idna==3.10
 + markdown-it-py==4.0.0
 + mdurl==0.1.2
 + numpy==2.3.3
 + psutil==7.1.0
 + pygments==2.19.2
 + python-dotenv==1.1.1
 + rich==14.1.0
 + sniffio==1.3.1
 + typing-extensions==4.15.0
 + watchfiles==1.1.0

❯ RUST_BACKTRACE=full uv run cocoindex ls
thread 'tokio-runtime-worker' panicked at src/lib_context.rs:287:70:
called `Result::unwrap()` on an `Err` value: ()
stack backtrace:
   0:        0x1086d65ec - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h373e57e2286956dc
   1:        0x1082ada8c - core::fmt::write::h2c4a0b98b09e3b30
   2:        0x1086d51a8 - std::io::Write::write_fmt::h00b4007fff731b84
   3:        0x1086d64ac - std::sys::backtrace::BacktraceLock::print::h3eb1535b8d3666ca
   4:        0x1086d4dcc - std::panicking::rust_panic_with_hook::hdd8ceeeb04975c2b
   5:        0x1086fe8c8 - std::panicking::begin_panic_handler::{{closure}}::hdf417b72ab8ffff8
   6:        0x1086fe838 - std::sys::backtrace::__rust_end_short_backtrace::h507d79c50996742e
   7:        0x1086ff1c8 - __rustc[5224e6b81cd82a8f]::rust_begin_unwind
   8:        0x108b5ebf0 - core::panicking::panic_fmt::h3505bfbec5a0b799
   9:        0x108b5ef78 - core::result::unwrap_failed::h7f68c62f4ec5b70e
  10:        0x1079fc3e8 - std::sync::poison::once::Once::call_once_force::{{closure}}::h2c20e03a0ecdabea
  11:        0x108b8daa4 - std::sys::sync::once::queue::Once::call::hecaba0a776a35aa1
  12:        0x108b20f00 - std::sync::once_lock::OnceLock<T>::initialize::he7ce31d700551564
  13:        0x107d48180 - cocoindex_engine::lib_context::create_lib_context::{{closure}}::h6261b68dbdb0538c
  14:        0x107d485b4 - cocoindex_engine::lib_context::get_lib_context::{{closure}}::ha84074c8394a6dbc
  15:        0x10782fbe0 - <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll{{reify.shim}}::h9eac255f3d259486
  16:        0x107c78678 - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::h554643cfe31013f8
  17:        0x107ba72ac - tokio::runtime::task::raw::poll::hd33f8c2a7d6ae0a5
  18:        0x108720eec - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::h305b7731758c2e05
  19:        0x108729ed4 - tokio::runtime::task::raw::poll::h46c67d31c2213be8
  20:        0x108708458 - std::sys::backtrace::__rust_begin_short_backtrace::h849cdc8b5e85a129
  21:        0x10870ec3c - core::ops::function::FnOnce::call_once{{vtable.shim}}::h97b67e24a813899e
  22:        0x1086ff530 - std::sys::pal::unix::thread::Thread::new::thread_start::h447d747a543e4adc
  23:        0x1864a3c0c - __pthread_cond_wait
Traceback (most recent call last):
  File "~/dev/test-cocoindex/.venv/bin/cocoindex", line 10, in <module>
    sys.exit(cli())
             ^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/click/core.py", line 1462, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/click/core.py", line 1383, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/click/core.py", line 1850, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/click/core.py", line 1246, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/click/core.py", line 814, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/cocoindex/cli.py", line 146, in ls
    persisted_flow_names = flow_names_with_setup()
                           ^^^^^^^^^^^^^^^^^^^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/cocoindex/setup.py", line 79, in flow_names_with_setup
    return execution_context.run(flow_names_with_setup_async())  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/cocoindex/runtime.py", line 35, in run
    return asyncio.run_coroutine_threadsafe(coro, self.event_loop).result()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "~/dev/test-cocoindex/.venv/lib/python3.12/site-packages/cocoindex/setup.py", line 87, in flow_names_with_setup_async
    all_flow_names = await _engine.flow_names_with_setup_async()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pyo3_async_runtimes.RustPanic: rust future panicked: unknown error

What i tried:

  • Tried claude code and gemini to isoloate the bug but got no luck.
  • Also tried to compiling cocoindex from source and and linking it to my project. Same result.
  • Also tried with different python versions
    • cpython-3.11.13-macos-aarch64-none
    • cpython-3.12.11-macos-aarch64-none
    • cpython-3.13.7-macos-aarch64-none
    • cpython-3.14.0rc2-macos-aarch64-none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions