Skip to main content

FailureReason

Enum FailureReason 

Source
pub enum FailureReason {
Show 14 variants Transport { status: Option<u16>, message: String, }, Backend { kind: BackendErrorKind, message: String, }, Unparseable(String), CacheMiss, ReviewLimit { completed: u32, limit: u32, }, ModelStopped { finish: String, message: String, }, Truncated, MalformedFinding(String), ToolUnavailable { tool: String, detail: String, }, FileTooLarge { bytes: u64, limit: u64, }, PayloadTooLarge { bytes: u64, limit: u64, }, Unreadable(String), Unsupported { extension: Option<String>, hint: Option<String>, }, ChainFailed(Vec<ProviderFailure>),
}
Expand description

Why one file went unanalyzed.

A bare set of paths cannot tell a dead endpoint from a rate limit from a truncated response, and the caller needs that to print something a user can act on. LlmError already carries the detail; it used to be discarded at the analyzer boundary.

Variants§

§

Transport

The endpoint was unreachable, or returned a retryable status too many times. status is the HTTP code when there was one.

Fields

§status: Option<u16>
§message: String
§

Backend

A non-HTTP backend failed with a structured routing class.

Fields

§message: String
§

Unparseable(String)

A response arrived and no JSON could be extracted from it.

§

CacheMiss

Cache-only review found no response for this exact prompt and provider.

§

ReviewLimit

A fresh semantic review was required after the configured remediation budget had already been consumed. This is fail-closed: cached reviews remain usable, but uncached code is never waved through unseen.

Fields

§completed: u32
§limit: u32
§

ModelStopped

The model stopped before producing JSON, and the server said why.

Distinct from Self::Unparseable because the cause is known and deterministic - an output-token cap or a content filter - so the answer is not “ask again” but “this request cannot be served as sent”. finish is the server’s own word for it, kept as a machine tag beside the human message exactly as Self::Transport keeps its status.

Fields

§finish: String
§message: String
§

Truncated

The response parsed only after closing unbalanced delimiters, so it is a prefix of what the model meant to say.

§

MalformedFinding(String)

A record in the response could not be understood - unknown severity, missing field, unusable line number.

§

ToolUnavailable

A deterministic tool that should have run could not.

Fields

§tool: String
§detail: String
§

FileTooLarge

The file on disk exceeded the read guard, so drep never read it.

Distinct from Self::PayloadTooLarge because the two measure different things: this is the file’s own size, checked before any I/O, and that one is the size of the text the model would have been sent. They were one variant sharing one limit, which meant bytes held the file size on one code path and the rendered-payload size on another - so “file is too large (330102 bytes)” could name a file that ls reports as 261900 bytes.

Fields

§bytes: u64
§limit: u64
§

PayloadTooLarge

The rendered LLM payload exceeded the ceiling. See Self::FileTooLarge.

Fields

§bytes: u64
§limit: u64
§

Unreadable(String)

The file could not be read from disk.

§

Unsupported

The user named a file that the running command has no analyzer for.

Only ever produced for an explicitly named path. A walk that turns up nothing analyzable is legitimately empty - drep check . in a documentation repository has correctly found no code. A path the user typed is different: reporting “No issues found.” for a file drep declined to look at is the single failure this codebase is built to prevent, and it is the same distinction resolve_paths already draws for an argument that does not exist at all.

hint names the command that does handle the type, when there is one. Markdown has drep lint-docs, so the error is a redirection rather than a dead end.

Fields

§extension: Option<String>

The extension as written, with its dot. None when the file has none, which reads differently in the message.

§hint: Option<String>

What to run instead, phrased as an imperative.

§

ChainFailed(Vec<ProviderFailure>)

A failover chain produced no answer, with what each provider contributed.

Only produced for a chain of two or more providers. A one-provider config - what drep init writes, and what almost every run uses - collapses to that provider’s own reason, so it reports exactly what it did before failover existed, JSON kind included. The trigger is the chain’s length, not the number of providers that failed: a two-provider chain stopped dead at the head by a 401 has one failure and is exactly the case where “which provider, and why did my fallback not run” is the user’s live question.

Keeping only the last reason would hide a dead local endpoint behind the cloud fallback’s 401; keeping only the first would hide the broken fallback. A user fixing the run needs both.

The list can be shorter than the chain - a 401 at the head stops it, and the providers below were never consulted.

Implementations§

Source§

impl FailureReason

Source

pub fn unsupported(path: &Path, hint: Option<String>) -> Self

Build an Self::Unsupported for path.

The extension convention (leading dot, None when there is none) is stated here, beside the variant whose one_line renders it, rather than at each command that raises one. It was written out twice, which is one copy per command pointing at the other.

Source

pub fn one_line(&self) -> String

A single line suitable for a terminal, derived from the variant.

The HTTP status is rendered next to the message so a 429 is visible without the user having to match the message against a status code list. This is the load-bearing reason the Transport variant carries the status as a number rather than only inside the string.

Source

pub fn status(&self) -> Option<u16>

The HTTP status, when the failure had one.

Only Transport ever carries one. Exposed as a number rather than left inside the message because a caller has to distinguish a 429 from a 401 - the message is prose and prose gets reworded.

Trait Implementations§

Source§

impl Clone for FailureReason

Source§

fn clone(&self) -> FailureReason

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FailureReason

Source§

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

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

impl Display for FailureReason

Source§

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

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

impl Eq for FailureReason

Source§

impl PartialEq for FailureReason

Source§

fn eq(&self, other: &FailureReason) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FailureReason

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more