{"record":{"id":"fb2d022478c629dc","repo":"pola-rs/polars","slug":"init-must-be-called-first","errorCode":null,"errorMessage":"init must be called first","messagePattern":"init must be called first","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-arrow/src/io/ipc/read/flight.rs","lineNumber":227,"sourceCode":"\n        let footer = Box::new(footer);\n\n        #[allow(clippy::unnecessary_cast)]\n        let ptr = Box::leak(footer) as *const _ as *const FooterRef<'static>;\n\n        self.footer = Some(ptr);\n        let footer = &unsafe { **self.footer.as_ref().unwrap() };\n\n        self.data_blocks = Some(Box::new(iter_recordbatch_blocks_from_footer(*footer)?)\n            as Box<dyn SendableIterator<Item = _>>);\n        self.dict_blocks = iter_dictionary_blocks_from_footer(*footer)?\n            .map(|i| Box::new(i) as Box<dyn SendableIterator<Item = _>>);\n\n        Ok(())\n    }\n\n    pub fn get_schema(self: &Pin<Box<Self>>) -> PolarsResult<EncodedData> {\n        let footer = &unsafe { **self.footer.as_ref().expect(\"init must be called first\") };\n\n        let schema_ref = deserialize_schema_ref_from_footer(*footer)?;\n        let schema = schema_to_raw_message(schema_ref);\n\n        Ok(schema)\n    }\n\n    pub async fn next_dict(\n        self: &mut Pin<Box<Self>>,\n        encoded_data: &mut EncodedData,\n    ) -> PolarsResult<Option<()>> {\n        assert!(self.data_blocks.is_some(), \"init must be called first\");\n        encoded_data.ipc_message.clear();\n        encoded_data.arrow_data.clear();\n\n        if let Some(iter) = &mut self.dict_blocks {\n            let Some(value) = iter.next() else {\n                return Ok(None);","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-arrow/src/io/ipc/read/flight.rs#L209-L245","documentation":"get_schema on the IPC Flight reader requires init() to have been called first so self.footer is populated. The error fires when get_schema (or another accessor) is invoked before the reader parsed the file footer, because footer-dependent state is None.","triggerScenarios":"Thrown at crates/polars-arrow/src/io/ipc/read/flight.rs:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call init() (or finish connecting) before accessing schema, record batches, or dictionary blocks","Ensure the Flight endpoint returned data before reading the schema","Restructure code to only construct dependent readers after successful initialization"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}