{"record":{"id":"2db4771bbaef9f21","repo":"cube-js/cube","slug":"tokio-runtime-error","errorCode":null,"errorMessage":"Tokio runtime error: {}","messagePattern":"Tokio runtime error: (.+?)","errorType":"exception","errorClass":"minijinja::Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-native/src/template/mj_value/python.rs","lineNumber":261,"sourceCode":"    fn call(&self, _state: &mj::State, args: &[Value]) -> Result<Value, mj::Error> {\n        let mut arguments = Vec::with_capacity(args.len());\n\n        for arg in args {\n            arguments.push(from_minijinja_value(arg)?);\n        }\n\n        let py_runtime = py_runtime().map_err(|err| {\n            mj::Error::new(\n                mj::ErrorKind::EvalBlock,\n                format!(\"Python runtime error: {}\", err),\n            )\n        })?;\n\n        let call_future =\n            Python::with_gil(|py| py_runtime.call_async(self.inner.clone_ref(py), arguments));\n\n        let tokio = tokio_runtime().map_err(|err| {\n            mj::Error::new(\n                mj::ErrorKind::EvalBlock,\n                format!(\"Tokio runtime error: {}\", err),\n            )\n        })?;\n\n        match tokio.block_on(call_future) {\n            Ok(r) => Ok(to_minijinja_value(r)),\n            Err(err) => Err(mj::Error::new(\n                mj::ErrorKind::EvalBlock,\n                format!(\"Call error: {}\", err),\n            )),\n        }\n    }\n}\n\nimpl StructObject for JinjaPythonFunction {\n    fn get_field(&self, _name: &str) -> Option<Value> {\n        None","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-native/src/template/mj_value/python.rs#L243-L279","documentation":"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.","triggerScenarios":"Thrown at packages/cubejs-backend-native/src/template/mj_value/python.rs:261 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the native backend initialized its Tokio runtime correctly at startup","Check startup logs for runtime creation errors and report a bug if it reproduces"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}