Skip to main content

ObjectError

Enum ObjectError 

Source
#[non_exhaustive]
pub enum ObjectError {
Show 28 variants InvalidId { input: String, }, HashCollision { oid: ObjectId, }, NotFound { name: String, }, PromisedMissing { oid: ObjectId, }, PromisorFetchFailed { missing: ObjectId, failures: Vec<PromisorFetchFailure>, }, PromisorFetchTooDeep { limit: u32, }, Corrupt { detail: String, }, PackIndexChecksumMismatch { path: PathBuf, mismatch: TrailerMismatch, }, UnresolvedDeltas { count: u64, }, PackDeltaBaseNotWritten { target: ObjectId, base: ObjectId, }, Invalid { kind: ObjectKind, check: FsckError, }, InvalidTreeEntry(TreeEntryError), InvalidSignature(SignatureError), UnexpectedKind { oid: ObjectId, expected: ObjectKind, actual: ObjectKind, }, CommitGraphParentMissing { commit: ObjectId, parent: ObjectId, }, DeltaChainTooDeep { limit: usize, }, UnknownType { name: String, }, HeaderTooLong { oid: String, }, Zlib { detail: String, },
#[non_exhaustive]
CorruptLoose { oid: ObjectId, path: PathBuf, source: Box<ObjectReadFailure>, },
#[non_exhaustive]
CorruptPacked { oid: ObjectId, pack: PathBuf, offset: u64, source: Box<ObjectReadFailure>, }, LooseHashMismatch { path: String, real_oid: String, }, LooseObjectWrite { path: String, source: Error, }, StreamTruncated { expected: u64, actual: u64, }, BitmapWalk(BitmapWalkError), Midx(MidxError), Offload(OffloadError), NoPromisorRemote { operation: &'static str, },
}
Expand description

Object database failure: loose objects, packs, indexes, commit-graph, multi-pack-index, and promisor (partial clone) objects.

Surfaced on the umbrella as Error::Object.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidId

A supplied object ID string was not valid hex or the wrong length.

Fields

§input: String

The text that was parsed as an object id.

§

HashCollision

SHA-1 object hashing detected a chosen-prefix collision (sha1dc).

Fields

§oid: ObjectId

Plain SHA-1 digest for the colliding input (not safe to use as an object id).

§

NotFound

The requested object does not exist in the object store.

Fields

§name: String

Object id (hex) or the name that was looked up.

§

PromisedMissing

A partial-clone promisor object is not present locally and no fetcher ran.

Fields

§oid: ObjectId

The missing object.

§

PromisorFetchFailed

Promised objects could not be fetched: every promisor remote was asked, and some failed. Self::PromisedMissing is used instead when every remote answered but none had the object.

Fields

§missing: ObjectId

The first object still missing after every remote was tried.

§failures: Vec<PromisorFetchFailure>

One entry per remote that failed, in the order they were tried.

§

PromisorFetchTooDeep

A promisor fetch triggered further promisor fetches more than limit levels deep.

Fields

§limit: u32

Maximum nesting of lazy fetches.

§

Corrupt

An object’s stored data is corrupt or malformed.

Fields

§detail: String

What is wrong with the object bytes.

§

PackIndexChecksumMismatch

A pack index (.idx) file’s trailing checksum does not match its contents.

Only reported by reads that verify the index trailer, such as crate::pack::read_pack_index; the checksum of the .pack the index describes is checked separately.

Fields

§path: PathBuf

The .idx file that failed verification.

§mismatch: TrailerMismatch

Expected and stored trailer digests.

§

UnresolvedDeltas

Indexing or unpacking a pack left deltas whose bases are neither in the pack nor in the object database: a thin pack without its bases, or a ref-delta cycle.

Fields

§count: u64

Number of deltas left unresolved.

§

PackDeltaBaseNotWritten

A pack being written that is not thin reached a delta before its base: the base is missing from the pack, or the planned deltas form a cycle. The receiver could not resolve that delta, so the pack was abandoned.

Fields

§target: ObjectId

The object that would have been stored as a delta.

§base: ObjectId

Its delta base, not written ahead of it.

§

Invalid

crate::objects::Objects::write refused a payload that git fsck would reject; nothing was written.

Fields

§kind: ObjectKind

Kind the payload was meant to be stored as.

§check: FsckError

The first fsck rule the payload breaks (check.id is Git’s fsck message id).

§

InvalidTreeEntry(TreeEntryError)

§

InvalidSignature(SignatureError)

A crate::ident::Signature cannot be written as an author, committer or tagger line.

§

UnexpectedKind

An object exists but has a different kind than the operation requires, such as a tree or blob where a commit was expected.

Fields

§oid: ObjectId

The object that was read.

§expected: ObjectKind

The kind the operation required.

§actual: ObjectKind

The kind the object actually has.

§

CommitGraphParentMissing

A commit-graph write was given a commit whose parent is neither among the commits being written nor in the base graph layers, so its parent edge cannot be encoded.

Fields

§commit: ObjectId

Commit whose parent list was being encoded.

§parent: ObjectId

Parent that is missing from the graph.

§

DeltaChainTooDeep

In-pack delta resolution exceeded the read-side chain depth limit (guards against cyclic ref-delta chains and unbounded recursion; Git has no read limit).

Fields

§limit: usize

Maximum delta chain depth allowed while reading packed objects.

§

UnknownType

An unsupported or unknown object type was encountered.

Fields

§name: String

The type token as read.

§

HeaderTooLong

Loose object header type field exceeds Git’s 32-byte limit.

Fields

§oid: String

Object id (hex) of the loose object with an oversized header.

§

Zlib

A zlib compression or decompression failure.

Fields

§detail: String

The zlib library’s description of the failure.

§

#[non_exhaustive]
CorruptLoose

A loose object file is present but its stored bytes could not be decoded.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§oid: ObjectId

Object id implied by the loose object path.

§path: PathBuf

Path to the loose object file (often under .git/objects/).

§source: Box<ObjectReadFailure>

Underlying zlib, header, or I/O failure.

§

#[non_exhaustive]
CorruptPacked

A pack entry names the object but its stored bytes could not be decoded.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§oid: ObjectId

Object id from the pack index.

§pack: PathBuf

Path to the .pack file.

§offset: u64

Byte offset of the object record in the pack.

§source: Box<ObjectReadFailure>

Underlying zlib, header, or I/O failure.

§

LooseHashMismatch

Loose object bytes hash to a different OID than the file path implies (git fsck / read_loose_object).

Fields

§path: String

Repository-relative or filesystem path to the loose object file.

§real_oid: String

Hex object id of the unpacked contents.

§

LooseObjectWrite

A prepared loose object could not be written during parallel index staging.

Fields

§path: String

Index-relative path of the blob being stored.

§source: Error

Underlying filesystem error from the object store.

§

StreamTruncated

A streamed object write or hash ended before the declared size was read.

Fields

§expected: u64

Payload size the caller declared.

§actual: u64

Bytes the stream delivered before end of file.

§

BitmapWalk(BitmapWalkError)

A bitmap reachability walk could not run or could not read the bitmap.

§

Midx(MidxError)

Multi-pack-index load or write failure.

§

Offload(OffloadError)

Offloading blobs to a large-object promisor was refused (Maintenance::offload_blobs).

§

NoPromisorRemote

The operation fetches objects back from a promisor remote, and the repository has none: no remote.<name>.promisor = true and no extensions.partialClone. Nothing was changed.

Fields

§operation: &'static str

Operation that was refused (for example "drop-large-blobs").

Implementations§

Source§

impl ObjectError

Source

pub fn kind_name(&self) -> &'static str

Stable snake_case slug for this failure (the former umbrella variant names, so scripts that branch on Error::kind_name keep working).

Trait Implementations§

Source§

impl Debug for ObjectError

Source§

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

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

impl Display for ObjectError

Source§

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

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

impl Error for ObjectError

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

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
Source§

impl From<BitmapWalkError> for ObjectError

Source§

fn from(source: BitmapWalkError) -> Self

Converts to this type from the input type.
Source§

impl From<MidxError> for ObjectError

Source§

fn from(source: MidxError) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectError> for Error

Source§

fn from(source: ObjectError) -> Self

Converts to this type from the input type.
Source§

impl From<OffloadError> for ObjectError

Source§

fn from(source: OffloadError) -> Self

Converts to this type from the input type.
Source§

impl From<SignatureError> for ObjectError

Source§

fn from(source: SignatureError) -> Self

Converts to this type from the input type.
Source§

impl From<TreeEntryError> for ObjectError

Source§

fn from(source: TreeEntryError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.