{"record":{"id":"fe9925bb8fea4a6e","repo":"cube-js/cube","slug":"unable-to-convert-seq-to-python","errorCode":null,"errorMessage":"Unable to convert Seq to Python","messagePattern":"Unable to convert Seq to Python","errorType":"exception","errorClass":"minijinja::Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-native/src/template/mj_value/python.rs","lineNumber":46,"sourceCode":"                    format!(\"Converting from {:?} to Python is not supported\", from),\n                ))\n            }\n        }\n        mjv::ValueKind::String => Ok(CLRepr::String(\n            from.as_str()\n                .expect(\"ValueKind::String must return string from as_str()\")\n                .to_string(),\n            if from.is_safe() {\n                StringType::Safe\n            } else {\n                StringType::Normal\n            },\n        )),\n        mjv::ValueKind::Seq => {\n            let seq = if let Some(seq) = from.as_seq() {\n                seq\n            } else {\n                return Err(mj::Error::new(\n                    mj::ErrorKind::InvalidOperation,\n                    \"Unable to convert Seq to Python\".to_string(),\n                ));\n            };\n\n            let mut arr = Vec::with_capacity(seq.item_count());\n\n            for idx in 0..seq.item_count() {\n                let v = if let Some(value) = seq.get_item(idx) {\n                    from_minijinja_value(&value)?\n                } else {\n                    CLRepr::Null\n                };\n\n                arr.push(v)\n            }\n\n            Ok(CLRepr::Array(arr))","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-native/src/template/mj_value/python.rs#L28-L64","documentation":"For `Seq`-kind MiniJinja values, `from_minijinja_value` calls `from.as_seq()`; if that returns `None` (the kind says Seq but the concrete sequence object can't be obtained), it raises `Unable to convert Seq to Python`. This is an internal representation failure rather than a user-data type mismatch.","triggerScenarios":"A MiniJinja value whose kind is `Seq` but whose underlying object does not expose a sequence (e.g. certain custom/foreign value implementations) passed into a Python filter, method call, or nested inside another converted value.","commonSituations":"Passing exotic template values (custom objects pretending to be sequences) into Python interop, or proxy/iterator values that report Seq kind without a materialized sequence.","solutions":["Materialize the value in the template first (e.g. wrap in `list(...)` or iterate into a plain list).","Check which value in the arguments failed — seqs nested in maps are converted recursively.","Convert the value to JSON in Jinja and parse it in Python as a workaround.","Report upstream if a standard MiniJinja list triggers this (indicates a native-layer bug)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match from_minijinja_value(&seq_val) {\n    Err(e) if e.to_string().contains(\"Unable to convert Seq\") => {\n        // serialize via JSON string instead and parse in Python\n    }\n    other => other?,\n}","preventionTips":["Materialize template iterators into plain lists before Python calls","Avoid exotic/custom template value implementations crossing the Python boundary","Prefer JSON-string handoff for complex nested structures"],"tags":["python","minijinja","type-conversion","template"],"backgroundTag":"unsupported-type-conversion","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}