cube-js/cube · error · minijinja::Error

Tokio runtime error: {}

Error message

Tokio runtime error: {}

What it means

While invoking a Python-backed Jinja function, the shared Tokio runtime required to drive the async Python call (tokio_runtime()) could not be acquired. The acquisition error follows the colon; this is an infrastructure failure in the native backend, before any Python code runs.

Source

Thrown at packages/cubejs-backend-native/src/template/mj_value/python.rs:261

    fn call(&self, _state: &mj::State, args: &[Value]) -> Result<Value, mj::Error> {
        let mut arguments = Vec::with_capacity(args.len());

        for arg in args {
            arguments.push(from_minijinja_value(arg)?);
        }

        let py_runtime = py_runtime().map_err(|err| {
            mj::Error::new(
                mj::ErrorKind::EvalBlock,
                format!("Python runtime error: {}", err),
            )
        })?;

        let call_future =
            Python::with_gil(|py| py_runtime.call_async(self.inner.clone_ref(py), arguments));

        let tokio = tokio_runtime().map_err(|err| {
            mj::Error::new(
                mj::ErrorKind::EvalBlock,
                format!("Tokio runtime error: {}", err),
            )
        })?;

        match tokio.block_on(call_future) {
            Ok(r) => Ok(to_minijinja_value(r)),
            Err(err) => Err(mj::Error::new(
                mj::ErrorKind::EvalBlock,
                format!("Call error: {}", err),
            )),
        }
    }
}

impl StructObject for JinjaPythonFunction {
    fn get_field(&self, _name: &str) -> Option<Value> {
        None

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Verify the native backend initialized its Tokio runtime correctly at startup
  2. Check startup logs for runtime creation errors and report a bug if it reproduces
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/cubejs-backend-native/src/template/mj_value/python.rs:261 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/2db4771bbaef9f21. Report an issue: GitHub.