{"record":{"id":"02be06999d5545fd","repo":"pola-rs/polars","slug":"the-batch-is-not-available","errorCode":null,"errorMessage":"The batch is not available","messagePattern":"The batch is not available","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-arrow/src/io/ipc/read/stream.rs","lineNumber":83,"sourceCode":"/// just doesn't hold any data right now.\npub enum StreamState {\n    /// A live stream without data\n    Waiting,\n    /// Next item in the stream\n    Some(RecordBatchT<Box<dyn Array>>),\n}\n\nimpl StreamState {\n    /// Return the data inside this wrapper.\n    ///\n    /// # Panics\n    ///\n    /// If the `StreamState` was `Waiting`.\n    pub fn unwrap(self) -> RecordBatchT<Box<dyn Array>> {\n        if let StreamState::Some(batch) = self {\n            batch\n        } else {\n            panic!(\"The batch is not available\")\n        }\n    }\n}\n\n/// Reads the next item, yielding `None` if the stream is done,\n/// and a [`StreamState`] otherwise.\nfn read_next<R: Read + Seek>(\n    reader: &mut R,\n    metadata: &StreamMetadata,\n    dictionaries: &mut Dictionaries,\n    message_buffer: &mut Vec<u8>,\n    projection: &Option<ProjectionInfo>,\n    scratch: &mut Vec<u8>,\n    checked: UnsafeBool,\n) -> PolarsResult<Option<StreamState>> {\n    // determine metadata length\n    let mut meta_length: [u8; 4] = [0; 4];\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-arrow/src/io/ipc/read/stream.rs#L65-L101","documentation":"Documented panic of StreamState::unwrap in the IPC stream reader: unwrap was called while the state was Waiting, i.e. the stream produced no batch for this iteration (e.g. an empty or exhausted message). Callers should match on StreamState::Some/Waiting instead of unwrapping.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"The batch is not available\". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.","commonSituations":"Encountered when input data or configuration does not meet the preconditions of the throwing code path (\"The batch is not available\"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.","solutions":["Poll the stream again later: the batch is produced asynchronously and is not ready yet.","Check whether the stream has finished or errored before requesting the next batch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}