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.
IO
A file system operation failed.
Includes the operation being performed and the path involved.
Archive
An archive extraction operation failed.
This occurs when extracting yt-dlp or ffmpeg archives.
Http
An HTTP request failed.
Includes the URL being accessed and the operation context.
Timeout
A network timeout occurred.
Indicates the operation and duration that was exceeded.
Json
JSON parsing or serialization failed.
Includes the context of what was being parsed/serialized.
Database
Database operation failed (redb backend).
Includes the specific operation that failed.
NoBinaryRelease
No GitHub release asset found for the current platform.
This occurs when trying to download yt-dlp or ffmpeg binaries.
BinaryNotFound
The required binary was not found after installation.
This indicates an installation issue or corrupted download.
CommandFailed
Command execution failed.
Includes the command, exit status, and stderr output.
VideoFetch
Failed to fetch video information from YouTube.
Includes the URL and reason for failure.
VideoMissingField
Video information is missing expected data.
This occurs when YouTube’s API returns incomplete data.
FormatNotAvailable
The requested format is not available.
Includes the format type and available alternatives.
FormatNoUrl
The format has no URL available for download.
This can occur with DRM-protected or geo-restricted content.
FormatIncompatible
The format is incompatible with the requested operation.
For example, trying to extract audio from a video-only format.
NoThumbnail
No thumbnail is available for the video.
SubtitleNotAvailable
No subtitles are available for the requested language.
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.
UrlValidation
URL validation failed.
This ensures only valid YouTube URLs are processed.
DownloadFailed
Download operation failed.
Includes the download ID and reason for failure.
DownloadCancelled
Download was cancelled by user or system.
InvalidPartialRange
A partial download range is invalid or the container format does not support seeking.
The video is not currently a live stream.
HlsParsing
Failed to parse an HLS manifest.
LiveRecording
A live recording operation failed.
LiveStreaming
A live streaming operation failed.
Metadata
A metadata tagging operation failed.
This occurs when reading or writing audio/video tags (ID3, MP4, lofty).
CacheMiss
The requested item was not found in the cache.
CacheExpired
The cached item has expired.
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.
ChecksumMismatch
A checksum verification failed after downloading.
InvalidHeader
An HTTP header value was invalid.
UnexpectedStatus
An HTTP response status was unexpected.
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
impl Error
Sourcepub fn io_with_path(
operation: impl Into<String>,
path: impl Into<PathBuf>,
source: Error,
) -> Self
pub fn io_with_path( operation: impl Into<String>, path: impl Into<PathBuf>, source: Error, ) -> Self
Sourcepub fn invalid_partial_range(reason: impl Into<String>) -> Self
pub fn invalid_partial_range(reason: impl Into<String>) -> Self
Sourcepub fn download_failed(download_id: u64, reason: impl Into<String>) -> Self
pub fn download_failed(download_id: u64, reason: impl Into<String>) -> Self
Sourcepub fn live_segment_fetch_failed(url: &str, status: StatusCode) -> Self
pub fn live_segment_fetch_failed(url: &str, status: StatusCode) -> Self
Sourcepub fn metadata(
operation: impl Into<String>,
path: impl Into<PathBuf>,
reason: impl Into<String>,
) -> Self
pub fn metadata( operation: impl Into<String>, path: impl Into<PathBuf>, reason: impl Into<String>, ) -> Self
Sourcepub fn cache_miss(key: impl Into<String>) -> Self
pub fn cache_miss(key: impl Into<String>) -> Self
Sourcepub fn cache_expired(key: impl Into<String>) -> Self
pub fn cache_expired(key: impl Into<String>) -> Self
Sourcepub fn ambiguous_cache_backend(count: usize) -> Self
pub fn ambiguous_cache_backend(count: usize) -> Self
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.