cube-js/cube · error · minijinja::Error
Python runtime error: {}
Error message
Python runtime error: {} What it means
Raised when invoking a Python-backed Jinja function but the global Python runtime could not be obtained (py_runtime() failed — interpreter not initialized or the native backend built without Python support). The underlying initialization error follows the colon; the template call never reaches Python code.
Source
Thrown at packages/cubejs-backend-native/src/template/mj_value/python.rs:251
_state: &mj::State,
_name: &str,
_args: &[Value],
) -> Result<Value, mj::Error> {
Err(mj::Error::new(
minijinja::ErrorKind::InvalidOperation,
"Unable to call method on Py<Function>",
))
}
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(View on GitHub (pinned to 7d981676b3)
Solutions
- Ensure the native backend is built and run with Python support enabled
- Check earlier logs for the Python runtime initialization failure that caused py_runtime() to error
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/cubejs-backend-native/src/template/mj_value/python.rs:251 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/a200041e4129d774.
Report an issue: GitHub.