sxyazi/yazi · error

View authority required

Error message

View authority required

What it means

UrlBuf::into_view converts a URL buffer into a view-backed URL, but only if the supplied auth is a view-kind authority. If `auth.kind.is_view()` is false, the conversion is refused with "View authority required" before any view metadata is attached.

Source

Thrown at yazi-shared/src/url/buf.rs:133

	fn eq(&self, other: &UrlCow) -> bool { self.as_url() == other.as_url() }
}

// --- Hash
impl Hash for UrlBuf {
	fn hash<H: Hasher>(&self, state: &mut H) { self.as_url().hash(state) }
}

impl UrlBuf {
	#[inline]
	pub fn into_loc(self) -> PathBufDyn {
		match self {
			Self::Os { loc, .. } => loc.into_inner().into(),
			Self::Unix { loc, .. } => loc.into_inner().into(),
		}
	}

	pub fn into_view(self, auth: AuthArc, data: Wire) -> Result<Self> {
		ensure!(auth.kind.is_view(), "View authority required");

		let source = self.physical().auth().clone();
		let auth = auth.with_view(View { source, data });
		auth.validate()?;

		Ok(match self {
			Self::Os { loc, .. } => Self::Os { loc: LocBuf::zeroed(loc.into_inner()), auth },
			Self::Unix { loc, .. } => Self::Unix { loc: LocBuf::zeroed(loc.into_inner()), auth },
		})
	}

	pub fn into_physical(self) -> Self {
		let Some(auth) = self.auth().view.auth().cloned() else { return self };

		match self {
			Self::Os { loc, .. } => Self::Os { loc: loc.into_inner().into(), auth },
			Self::Unix { loc, .. } => Self::Unix { loc: loc.into_inner().into(), auth },
		}

View on GitHub (pinned to 8ebf930f17)

Solutions

  1. Pass an auth whose kind is a view variant; create it via the view-auth constructor or clone an existing view auth.
  2. If you meant to attach view metadata to this auth, first construct the view-kind auth (with a Regular/Sftp source) then call into_view.
  3. Double-check where the AuthArc came from — physical URL auth is never view-kind.

Example fix

// before
url.into_view(url.physical().auth().clone(), data)?;
// after
let view_auth = AuthArc::view(url.physical().auth().clone());
url.into_view(view_auth, data)?;
Defensive patterns

Strategy: type-guard

Validate before calling

if !auth.kind.is_view() {
    return Err(anyhow!("into_view needs a view-kind auth"));
}

Type guard

fn is_view_auth(auth: &AuthArc) -> bool { auth.kind.is_view() }

Try / catch

// match on result
let viewed = url.into_view(auth, data).context("converting to view URL")?;

Prevention

When it happens

Trigger: Calling `url_buf.into_view(auth, data)` passing an auth whose kind is Regular, Sftp, or Hub instead of a view variant.

Common situations: Plugin code that fetched the current tab/URL auth (regular or SFTP) and passed it to into_view expecting it to create a view; confusing physical auth with view auth when constructing custom views (e.g. archive/mount pseudo-filesystems).

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/624ca70216baf58a. Report an issue: GitHub.