Skip to main content

ParserError

Enum ParserError 

Source
pub enum ParserError {
    Io {
        path: String,
        source: Error,
    },
    UnsupportedFormat {
        path: String,
        reason: String,
    },
    MissingTensor {
        name: String,
        path: String,
    },
    InvalidLayout {
        path: String,
        reason: String,
    },
    ExpertOutOfRange {
        block: usize,
        expert: usize,
        available: usize,
    },
    LimitExceeded {
        path: String,
        limit: ParseLimitKind,
        declared: u64,
        budget: u64,
    },
    HostSizeOverflow {
        path: String,
        field: HostSizeField,
        value: u64,
    },
    DuplicateTensorOwnership {
        name: String,
        shards: Vec<String>,
        path: String,
    },
    MissingShard {
        shard: String,
        path: String,
    },
    FeatureDisabled {
        path: String,
        feature: &'static str,
    },
}
Expand description

Unified error type for checkpoint parsing and MoE weight extraction.

Variants§

§

Io

The underlying file could not be read.

Fields

§path: String

Path of the checkpoint being opened.

§source: Error

Upstream std::io::Error.

§

UnsupportedFormat

The file is not a valid checkpoint (bad magic, unsupported version, unknown value type, unexpected Safetensors layout, …).

Fields

§path: String

Path of the offending checkpoint.

§reason: String

Human-readable explanation.

§

MissingTensor

A required tensor was not found in the checkpoint.

Fields

§name: String

Tensor name (or suffix) that was looked up.

§path: String

Path of the checkpoint.

§

InvalidLayout

The checkpoint’s on-disk layout is internally inconsistent (tensor extends past EOF, element-count overflow, etc.).

Fields

§path: String

Path of the checkpoint.

§reason: String

Human-readable explanation.

§

ExpertOutOfRange

An expert index was out of range for the requested block or stacked tensor.

Fields

§block: usize

Block index that was queried.

§expert: usize

Expert index that was queried.

§available: usize

Number of experts actually available.

§

LimitExceeded

A crate::ParseLimits budget was exhausted by a file-declared value.

Fields

§path: String

Path of the checkpoint.

§limit: ParseLimitKind

Budget that was exhausted.

§declared: u64

Declared or accumulated value that exceeded the budget.

§budget: u64

Configured budget for limit.

§

HostSizeOverflow

A file-declared u64 could not be represented as a host usize.

Fields

§path: String

Path of the checkpoint.

§field: HostSizeField

On-wire field that overflowed.

§value: u64

Declared value that does not fit in usize.

§

DuplicateTensorOwnership

A tensor name is claimed by more than one Safetensors shard.

Fields

§name: String

Tensor name with conflicting owners.

§shards: Vec<String>

Checkpoint-relative shard paths that declare the tensor, sorted.

§path: String

Path of the checkpoint or index being inspected.

§

MissingShard

An index-referenced Safetensors shard is missing on disk.

Fields

§shard: String

Shard path as declared in the index (checkpoint-relative).

§path: String

Path of the index or checkpoint that referenced the shard.

§

FeatureDisabled

The input needs a backend whose cargo feature is not enabled (for example Safetensors input without --features safetensors).

Fields

§path: String

Path of the checkpoint.

§feature: &'static str

Cargo feature that would enable the backend.

Trait Implementations§

Source§

impl Debug for ParserError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParserError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ParserError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for ParserError

§

impl !UnwindSafe for ParserError

§

impl Forget for ParserError

§

impl Freeze for ParserError
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const () is !null: Freeze, PhantomData<ErrorData<CustomOwner>>: Freeze, PhantomData<String>: Freeze, &'static str: Freeze,

§

impl Move for ParserError

§

impl Send for ParserError
where RawVecInner: Send, Repr: Send, &'static str: Send,

§

impl Sync for ParserError
where RawVecInner: Sync, Repr: Sync,

§

impl Unpin for ParserError
where *const u8 is !null: Unpin, *const () is !null: Unpin, &'static SimpleMessage: Unpin, *const Custom is !null: Unpin, &'static str: Unpin,

§

impl UnsafeUnpin for ParserError

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.