{"record":{"id":"f721a6d27495756a","repo":"bevyengine/bevy","slug":"could-not-create-a-chunkedunevencore","errorCode":null,"errorMessage":"Could not create a ChunkedUnevenCore","messagePattern":"Could not create a ChunkedUnevenCore","errorType":"exception","errorClass":"ChunkedUnevenCoreError","httpStatus":null,"severity":"error","filePath":"crates/bevy_math/src/curve/cores.rs","lineNumber":485,"sourceCode":"#[cfg_attr(feature = \"bevy_reflect\", derive(Reflect))]\npub struct ChunkedUnevenCore<T> {\n    /// The times, one for each sample.\n    ///\n    /// # Invariants\n    /// This must always have a length of at least 2, be sorted, and have no duplicated or\n    /// non-finite times.\n    pub times: Vec<f32>,\n\n    /// The values that are used in sampling. Each width-worth of these correspond to a single sample.\n    ///\n    /// # Invariants\n    /// The length of this vector must always be some fixed integer multiple of that of `times`.\n    pub values: Vec<T>,\n}\n\n/// An error that indicates that a [`ChunkedUnevenCore`] could not be formed.\n#[derive(Debug, Error)]\n#[error(\"Could not create a ChunkedUnevenCore\")]\npub enum ChunkedUnevenCoreError {\n    /// The width of a `ChunkedUnevenCore` cannot be zero.\n    #[error(\"Chunk width must be at least 1\")]\n    ZeroWidth,\n\n    /// At least two sample times are necessary to interpolate in `ChunkedUnevenCore`.\n    #[error(\n        \"Need at least two unique samples to create a ChunkedUnevenCore, but {samples} were provided\"\n    )]\n    NotEnoughSamples {\n        /// The number of samples that were provided.\n        samples: usize,\n    },\n\n    /// The length of the value buffer is supposed to be the `width` times the number of samples.\n    #[error(\"Expected {expected} total values based on width, but {actual} were provided\")]\n    MismatchedLengths {\n        /// The expected length of the value buffer.","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_math/src/curve/cores.rs#L467-L503","documentation":"ChunkedUnevenCoreError is the umbrella error for ChunkedUnevenCore::new and ChunkedUnevenCore::new_width_inferred. The enum carries four concrete variants (ZeroWidth, NotEnoughSamples, MismatchedLengths, NonDivisibleLengths); this top-level text appears when the error is displayed without matching a variant, hiding which check failed. ChunkedUnevenCore stores vector-valued samples ('width' values per time) interpolated at uneven times.","triggerScenarios":"Any failing ChunkedUnevenCore::new(times, values, width) or new_width_inferred(times, values) call whose error is then formatted with {} (e.g. through anyhow) so only the umbrella message is printed.","commonSituations":"Building curves whose samples are vectors/matrices (e.g. multi-channel animation data) and logging failures generically in a plugin or asset loader.","solutions":["Match on the variant to learn the failed invariant: ZeroWidth, NotEnoughSamples, MismatchedLengths, or NonDivisibleLengths.","Log with {:?} to keep the variant payload.","Prefer new() over new_width_inferred — it validates more and gives the clearer MismatchedLengths error."],"exampleFix":"// before\nlet core = ChunkedUnevenCore::new(times, values, width).map_err(|e| log::error!(\"core failed: {e}\"))?; // generic\n\n// after\nlet core = match ChunkedUnevenCore::new(times, values, width) {\n    Ok(core) => core,\n    Err(e @ (ChunkedUnevenCoreError::ZeroWidth\n    | ChunkedUnevenCoreError::NotEnoughSamples { .. }\n    | ChunkedUnevenCoreError::MismatchedLengths { .. }\n    | ChunkedUnevenCoreError::NonDivisibleLengths { .. })) => {\n        log::error!(\"chunked core rejected: {e:?}\");\n        return;\n    }\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match ChunkedUnevenCore::new(times, values, width) {\n    Ok(core) => core,\n    Err(e) => {\n        error!(\"chunked core rejected: {e:?}\"); // variant + payload stay visible\n        return Ok(());\n    }\n}","preventionTips":["Always format ChunkedUnevenCoreError with {:?} or match variants; never plain {e}.","Prefer new(width explicit) over new_width_inferred for better error specificity.","Route all chunked-core construction through one helper with variant-level logging."],"tags":["rust","bevy","math","curve","runtime","error-matching"],"backgroundTag":"curve-core-construction-failed","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}