{"record":{"id":"8eb73a4def097d78","repo":"BoundaryML/baml","slug":"getattr-streamstate","errorCode":null,"errorMessage":"getattr(StreamState)","messagePattern":"getattr\\(StreamState\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_python/src/types/function_results.rs","lineNumber":367,"sourceCode":"        Ok::<Py<PyAny>, PyErr>(checked_instance.into())\n    } else {\n        Ok(py_value_without_constraints)\n    }?;\n\n    let value_with_possible_completion_state = if completion_state.display && allow_partials {\n        let value_type = value_with_possible_checks.bind(py).get_type();\n\n        // Prepare the properties dictionary\n        let properties_dict = pyo3::types::PyDict::new(py);\n        properties_dict.set_item(\"value\", value_with_possible_checks)?;\n        properties_dict.set_item(\"state\", format!(\"{:?}\", completion_state.state))?;\n\n        // Prepare type parameters for StreamingState[...]\n        let type_parameters_tuple = PyTuple::new(py, [value_type.as_ref()]).expect(\"PyTuple::new\");\n\n        let class_streaming_state_type_constructor = partial_cls_module\n            .getattr(\"StreamState\")\n            .expect(\"getattr(StreamState)\");\n        let class_completion_state_type: Bound<'_, PyAny> = class_streaming_state_type_constructor\n            .call_method1(\"__class_getitem__\", (type_parameters_tuple,))\n            .expect(\"__class_getitem__ for streaming\");\n\n        let streaming_state_instance = class_completion_state_type\n            .call_method(model_validate_method, (properties_dict.clone(),), None)\n            .expect(model_validate_method);\n\n        Ok::<Py<PyAny>, PyErr>(streaming_state_instance.into())\n    } else {\n        Ok(value_with_possible_checks)\n    }?;\n\n    Ok(value_with_possible_completion_state)\n}\n","sourceCodeStart":349,"sourceCodeEnd":383,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_python/src/types/function_results.rs#L349-L383","documentation":"pythonize_strict fetches `StreamState` from the partial-types Python module to wrap streaming values. `.expect(\"getattr(StreamState)\")` panics if the module does not expose that attribute, meaning the Python runtime package is missing or renamed the class.","triggerScenarios":"Any streaming call (allow_partials=true) where partial_cls_module lacks a `StreamState` attribute — e.g. an older baml-py installed against a newer engine.","commonSituations":"Version skew: engine emits streaming state metadata but the installed Python client predates the StreamState class, or a broken/partial pip install.","solutions":["pip install --upgrade baml to match the engine version","Check the installed baml_py version with pip show baml-py and align with the BAML CLI version","Reinstall the virtualenv to fix partial installs","File a bug if versions match"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"python -c \"import baml_py, inspect; print([n for n in dir(baml_py) if 'Stream' in n])\"  # must include StreamState","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run pip show baml-py and confirm it matches the BAML CLI version","Use a clean virtualenv per project","After upgrades, run one streaming call as a smoke test"],"tags":["python","ffi","streaming","version-mismatch"],"backgroundTag":"missing-dependency","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}