1use crate::install::provider::InstallProviderId;
4use crate::records::format_bytes;
5
6#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
8pub enum InstallError {
9 #[error("No install provider is registered as {0}.")]
11 ProviderUnknown(InstallProviderId),
12 #[error("{0}")]
14 ProviderUnavailable(String),
15 #[error("{0} is not a reference this provider understands.")]
17 ReferenceInvalid(String),
18 #[error("{0} was not found on the platform.")]
20 ReferenceNotFound(String),
21 #[error(
24 "{0} is gated. Accept its terms and request access at https://huggingface.co/{0}, then set HF_TOKEN to a token with read access (or sign in with `huggingface-cli login`)."
25 )]
26 AuthRequired(String),
27 #[error(
29 "Not enough free disk space: this model needs {} and {} is available.",
30 format_bytes(*required_bytes),
31 format_bytes(*available_bytes)
32 )]
33 InsufficientDisk {
34 required_bytes: i64,
36 available_bytes: i64,
38 },
39 #[error("{0} failed checksum verification after download.")]
41 ChecksumMismatch(String),
42 #[error("{0}")]
44 TransferFailed(String),
45}