sxyazi/yazi · error

View source must be Regular or Sftp

Error message

View source must be Regular or Sftp

What it means

For a valid view auth, validate() additionally requires the view's SOURCE auth to be either a Regular (local) or Sftp authority. Views must be backed by an actual browsable filesystem; a view whose source is another view, hub, or other exotic kind is rejected.

Source

Thrown at yazi-shared/src/auth/auth.rs:63

	pub fn physical(&self) -> &Self { self.view.auth().map_or(self, |a| a) }

	#[inline]
	pub(crate) fn path_kind(&self) -> Result<PathKind> { self.physical().kind.try_into() }

	#[inline]
	pub fn covariant(&self, other: &Self) -> bool { self.physical() == other.physical() }

	pub fn same_service(&self, other: &Self) -> bool {
		self.covariant(other)
			|| self.kind.is_hub() && other.kind.is_hub() && self.scheme == other.scheme
	}

	pub(crate) fn validate(&self) -> Result<()> {
		match (self.kind.is_view(), self.view.auth()) {
			(true, None) => bail!("View auth requires view metadata"),
			(false, Some(_)) => bail!("Non-view auth cannot have view metadata"),
			(true, Some(source)) => {
				ensure!(source.is_regular() || source.kind.is_sftp(), "View source must be Regular or Sftp")
			}
			_ => {}
		}
		Ok(())
	}

	pub(crate) fn parent_depth(&self) -> usize {
		let mut depth = 0;
		let mut parent = self.parent.as_ref();
		while let Some(auth) = parent {
			depth += 1;
			parent = auth.parent.as_ref();
		}
		depth
	}
}

impl<'de> Deserialize<'de> for Auth {

View on GitHub (pinned to 8ebf930f17)

Solutions

  1. Point the view's source at a Regular (local path) or Sftp auth — take it from `url.physical().auth()` of a concrete local/SFTP location.
  2. Remove the intermediate view/hub layer so the view wraps a concrete filesystem auth.
  3. If you need derived views, add an explicit yazi-level mechanism instead of nesting view authorities.

Example fix

// before
let source = other_view_auth.clone(); // a view auth
// after
let source = url.physical().auth().clone(); // Regular or Sftp auth
let auth = auth.with_view(View { source, data });
Defensive patterns

Strategy: validation

Validate before calling

fn view_source_ok(auth: &Auth) -> bool {
    auth.view.auth().map_or(false, |s| s.is_regular() || s.kind.is_sftp())
}

Prevention

When it happens

Trigger: Calling `Auth::validate()` on a view-kind auth whose inner `View.source` auth kind is neither regular nor Sftp — e.g. stacking a view on top of a view, or pointing a view at a hub authority.

Common situations: Building nested views (view-of-view) in plugins; deriving view auth from a hub URL; programmatic auth construction where the source was taken from the wrong URL layer.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of sxyazi/yazi@8ebf930f17 (2026-09-09). Data as JSON: /api/errors/eba497c4763b613e. Report an issue: GitHub.