{"record":{"id":"a200041e4129d774","repo":"cube-js/cube","slug":"python-runtime-error","errorCode":null,"errorMessage":"Python runtime error: {}","messagePattern":"Python runtime error: (.+?)","errorType":"exception","errorClass":"minijinja::Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-native/src/template/mj_value/python.rs","lineNumber":251,"sourceCode":"        _state: &mj::State,\n        _name: &str,\n        _args: &[Value],\n    ) -> Result<Value, mj::Error> {\n        Err(mj::Error::new(\n            minijinja::ErrorKind::InvalidOperation,\n            \"Unable to call method on Py<Function>\",\n        ))\n    }\n\n    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(","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-native/src/template/mj_value/python.rs#L233-L269","documentation":"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.","triggerScenarios":"Thrown at packages/cubejs-backend-native/src/template/mj_value/python.rs:251 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"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"}