Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 35 variants Runtime { context: String, source: JoinError, }, IO { operation: String, path: Option<PathBuf>, source: Error, }, Archive { file: String, source: ArchiveError, }, Http { url: String, context: String, source: Error, }, Timeout { operation: String, duration: Duration, }, Json { context: String, source: Error, }, Database { operation: String, source: Box<Error>, }, NoBinaryRelease { binary: String, platform: Platform, architecture: Architecture, }, BinaryNotFound { binary: String, path: PathBuf, }, CommandFailed { command: String, exit_code: i32, stderr: String, }, VideoFetch { url: String, reason: String, }, VideoMissingField { video_id: String, field: String, }, FormatNotAvailable { video_id: String, format_type: FormatType, available_formats: Vec<String>, }, FormatNoUrl { video_id: String, format_id: String, }, FormatIncompatible { format_id: String, reason: String, }, NoThumbnail { video_id: String, }, SubtitleNotAvailable { video_id: String, language: String, }, UrlExpired, PathValidation { path: PathBuf, reason: String, }, UrlValidation { url: String, reason: String, }, DownloadFailed { download_id: u64, reason: String, }, DownloadCancelled { download_id: u64, }, InvalidPartialRange { reason: String, }, LiveStreamUnavailable { url: String, live_status: String, reason: String, }, HlsParsing { url: String, context: String, }, LiveRecording { url: String, reason: String, }, LiveStreaming { url: String, reason: String, }, Metadata { operation: String, path: PathBuf, reason: String, }, CacheMiss { key: String, }, CacheExpired { key: String, }, AmbiguousCacheBackend { count: usize, }, ChecksumMismatch { path: PathBuf, expected: String, actual: String, }, InvalidHeader { header: String, reason: String, }, UnexpectedStatus { status: u16, url: String, }, Unknown(String),
}
Expand description

The possible errors that can occur in the yt-dlp library.

Each error variant provides detailed context about what went wrong, including the operation being performed and any relevant parameters.

Variants§

§

Runtime

An async task failed to complete.

This typically indicates a panic in a spawned tokio task or a cancellation.

Fields

§context: String
§source: JoinError
§

IO

A file system operation failed.

Includes the operation being performed and the path involved.

Fields

§operation: String
§source: Error
§

Archive

An archive extraction operation failed.

This occurs when extracting yt-dlp or ffmpeg archives.

Fields

§file: String
§

Http

An HTTP request failed.

Includes the URL being accessed and the operation context.

Fields

§context: String
§source: Error
§

Timeout

A network timeout occurred.

Indicates the operation and duration that was exceeded.

Fields

§operation: String
§duration: Duration
§

Json

JSON parsing or serialization failed.

Includes the context of what was being parsed/serialized.

Fields

§context: String
§source: Error
§

Database

Database operation failed (redb backend).

Includes the specific operation that failed.

Fields

§operation: String
§source: Box<Error>
§

NoBinaryRelease

No GitHub release asset found for the current platform.

This occurs when trying to download yt-dlp or ffmpeg binaries.

Fields

§binary: String
§platform: Platform
§architecture: Architecture
§

BinaryNotFound

The required binary was not found after installation.

This indicates an installation issue or corrupted download.

Fields

§binary: String
§path: PathBuf
§

CommandFailed

Command execution failed.

Includes the command, exit status, and stderr output.

Fields

§command: String
§exit_code: i32
§stderr: String
§

VideoFetch

Failed to fetch video information from YouTube.

Includes the URL and reason for failure.

Fields

§reason: String
§

VideoMissingField

Video information is missing expected data.

This occurs when YouTube’s API returns incomplete data.

Fields

§video_id: String
§field: String
§

FormatNotAvailable

The requested format is not available.

Includes the format type and available alternatives.

Fields

§video_id: String
§format_type: FormatType
§available_formats: Vec<String>
§

FormatNoUrl

The format has no URL available for download.

This can occur with DRM-protected or geo-restricted content.

Fields

§video_id: String
§format_id: String
§

FormatIncompatible

The format is incompatible with the requested operation.

For example, trying to extract audio from a video-only format.

Fields

§format_id: String
§reason: String
§

NoThumbnail

No thumbnail is available for the video.

Fields

§video_id: String
§

SubtitleNotAvailable

No subtitles are available for the requested language.

Fields

§video_id: String
§language: String
§

UrlExpired

The URL has expired and needs to be refreshed.

§

PathValidation

Path validation failed due to security concerns.

This prevents path traversal and other security issues.

Fields

§path: PathBuf
§reason: String
§

UrlValidation

URL validation failed.

This ensures only valid YouTube URLs are processed.

Fields

§reason: String
§

DownloadFailed

Download operation failed.

Includes the download ID and reason for failure.

Fields

§download_id: u64
§reason: String
§

DownloadCancelled

Download was cancelled by user or system.

Fields

§download_id: u64
§

InvalidPartialRange

A partial download range is invalid or the container format does not support seeking.

Fields

§reason: String
§

LiveStreamUnavailable

The video is not currently a live stream.

Fields

§live_status: String
§reason: String
§

HlsParsing

Failed to parse an HLS manifest.

Fields

§context: String
§

LiveRecording

A live recording operation failed.

Fields

§reason: String
§

LiveStreaming

A live streaming operation failed.

Fields

§reason: String
§

Metadata

A metadata tagging operation failed.

This occurs when reading or writing audio/video tags (ID3, MP4, lofty).

Fields

§operation: String
§path: PathBuf
§reason: String
§

CacheMiss

The requested item was not found in the cache.

Fields

§

CacheExpired

The cached item has expired.

Fields

§

AmbiguousCacheBackend

Multiple persistent cache backends are compiled in but none was selected.

Set CacheConfig::persistent_backend explicitly when more than one of cache-json, cache-redb, or cache-redis features are active.

Fields

§count: usize
§

ChecksumMismatch

A checksum verification failed after downloading.

Fields

§path: PathBuf
§expected: String
§actual: String
§

InvalidHeader

An HTTP header value was invalid.

Fields

§header: String
§reason: String
§

UnexpectedStatus

An HTTP response status was unexpected.

Fields

§status: u16
§

Unknown(String)

An unexpected error occurred that doesn’t fit other categories.

This should be used sparingly and ideally replaced with more specific variants.

Implementations§

Source§

impl Error

Source

pub fn io(operation: impl Into<String>, source: Error) -> Self

Create an IO error with operation context.

§Arguments
  • operation - Description of the operation that failed
  • source - The underlying IO error
§Returns

An Error::IO variant with the provided context

Source

pub fn io_with_path( operation: impl Into<String>, path: impl Into<PathBuf>, source: Error, ) -> Self

Create an IO error with operation and path context.

§Arguments
  • operation - Description of the operation that failed
  • path - The file path involved in the operation
  • source - The underlying IO error
§Returns

An Error::IO variant with the provided context and path

Source

pub fn http( url: impl Into<String>, context: impl Into<String>, source: Error, ) -> Self

Create an HTTP error with URL context.

§Arguments
  • url - The URL that was being accessed
  • context - Additional context about the operation
  • source - The underlying reqwest error
§Returns

An Error::Http variant with the provided context

Source

pub fn json(context: impl Into<String>, source: Error) -> Self

Create a JSON parsing error with context.

§Arguments
  • context - Description of what was being parsed/serialized
  • source - The underlying serde_json error
§Returns

An Error::Json variant with the provided context

Source

pub fn database(operation: impl Into<String>, source: impl Into<Error>) -> Self

Create a database error with operation context (redb).

§Arguments
  • operation - Description of the database operation that failed
  • source - The underlying redb error
§Returns

An Error::Database variant with the provided context

Source

pub fn runtime(context: impl Into<String>, source: JoinError) -> Self

Create a runtime error with context.

§Arguments
  • context - Description of the task that failed
  • source - The underlying tokio JoinError
§Returns

An Error::Runtime variant with the provided context

Source

pub fn video_fetch(url: impl Into<String>, reason: impl Into<String>) -> Self

Create a video fetch error.

§Arguments
  • url - The URL that failed to fetch
  • reason - The reason for the fetch failure
§Returns

An Error::VideoFetch variant with the provided details

Source

pub fn path_validation( path: impl Into<PathBuf>, reason: impl Into<String>, ) -> Self

Create a path validation error.

§Arguments
  • path - The path that failed validation
  • reason - The reason for validation failure
§Returns

An Error::PathValidation variant with the provided details

Source

pub fn url_validation(url: impl Into<String>, reason: impl Into<String>) -> Self

Create a URL validation error.

§Arguments
  • url - The URL that failed validation
  • reason - The reason for validation failure
§Returns

An Error::UrlValidation variant with the provided details

Source

pub fn invalid_partial_range(reason: impl Into<String>) -> Self

Create an invalid partial range error.

§Arguments
  • reason - Description of why the partial range is invalid
§Returns

An Error::InvalidPartialRange variant with the provided reason

Source

pub fn download_failed(download_id: u64, reason: impl Into<String>) -> Self

Create a download failed error.

§Arguments
  • download_id - The ID of the download that failed
  • reason - The reason for the download failure
§Returns

An Error::DownloadFailed variant with the provided details

Source

pub fn live_unavailable( url: impl Into<String>, live_status: impl Into<String>, reason: impl Into<String>, ) -> Self

Create a live stream unavailable error.

§Arguments
  • url - The URL of the video
  • live_status - The current live status of the video
  • reason - Why the stream is not available
§Returns

An Error::LiveStreamUnavailable variant with the provided details

Source

pub fn hls_parsing(url: impl Into<String>, context: impl Into<String>) -> Self

Create an HLS parsing error.

§Arguments
  • url - The URL of the manifest that failed to parse
  • context - Description of the parsing failure
§Returns

An Error::HlsParsing variant with the provided details

Source

pub fn live_recording(url: impl Into<String>, reason: impl Into<String>) -> Self

Create a live recording error.

§Arguments
  • url - The URL of the live stream
  • reason - Why the recording failed
§Returns

An Error::LiveRecording variant with the provided details

Source

pub fn live_streaming(url: impl Into<String>, reason: impl Into<String>) -> Self

Create a live streaming error.

§Arguments
  • url - The URL of the live stream
  • reason - Why the streaming failed
§Returns

An Error::LiveStreaming variant with the provided details

Source

pub fn live_segment_fetch_failed(url: &str, status: StatusCode) -> Self

Create an error for a failed live segment fetch.

§Arguments
  • url - The URL of the live segment
  • status - The HTTP status code returned
§Returns

An Error::LiveStreaming variant with the provided details

Source

pub fn metadata( operation: impl Into<String>, path: impl Into<PathBuf>, reason: impl Into<String>, ) -> Self

Create a metadata error with operation and path context.

§Arguments
  • operation - Description of the metadata operation (e.g. “read MP4 tags”)
  • path - The file path involved
  • reason - The reason for the failure
§Returns

An Error::Metadata variant with the provided context

Source

pub fn cache_miss(key: impl Into<String>) -> Self

Create a cache miss error.

§Arguments
  • key - The cache key that was not found
§Returns

An Error::CacheMiss variant

Source

pub fn cache_expired(key: impl Into<String>) -> Self

Create a cache expired error.

§Arguments
  • key - The cache key that expired
§Returns

An Error::CacheExpired variant

Source

pub fn ambiguous_cache_backend(count: usize) -> Self

Create an ambiguous cache backend error.

§Arguments
  • count - The number of persistent backends compiled in
§Returns

An Error::AmbiguousCacheBackend variant

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Available on crate feature cache-redb only.
Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<JoinError> for Error

Source§

fn from(err: JoinError) -> Self

Converts to this type from the input type.
Source§

impl From<ZipError> for Error

Source§

fn from(err: ZipError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> 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 = 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