{"record":{"id":"624ca70216baf58a","repo":"sxyazi/yazi","slug":"view-authority-required","errorCode":null,"errorMessage":"View authority required","messagePattern":"View authority required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-shared/src/url/buf.rs","lineNumber":133,"sourceCode":"\tfn eq(&self, other: &UrlCow) -> bool { self.as_url() == other.as_url() }\n}\n\n// --- Hash\nimpl Hash for UrlBuf {\n\tfn hash<H: Hasher>(&self, state: &mut H) { self.as_url().hash(state) }\n}\n\nimpl UrlBuf {\n\t#[inline]\n\tpub fn into_loc(self) -> PathBufDyn {\n\t\tmatch self {\n\t\t\tSelf::Os { loc, .. } => loc.into_inner().into(),\n\t\t\tSelf::Unix { loc, .. } => loc.into_inner().into(),\n\t\t}\n\t}\n\n\tpub fn into_view(self, auth: AuthArc, data: Wire) -> Result<Self> {\n\t\tensure!(auth.kind.is_view(), \"View authority required\");\n\n\t\tlet source = self.physical().auth().clone();\n\t\tlet auth = auth.with_view(View { source, data });\n\t\tauth.validate()?;\n\n\t\tOk(match self {\n\t\t\tSelf::Os { loc, .. } => Self::Os { loc: LocBuf::zeroed(loc.into_inner()), auth },\n\t\t\tSelf::Unix { loc, .. } => Self::Unix { loc: LocBuf::zeroed(loc.into_inner()), auth },\n\t\t})\n\t}\n\n\tpub fn into_physical(self) -> Self {\n\t\tlet Some(auth) = self.auth().view.auth().cloned() else { return self };\n\n\t\tmatch self {\n\t\t\tSelf::Os { loc, .. } => Self::Os { loc: loc.into_inner().into(), auth },\n\t\t\tSelf::Unix { loc, .. } => Self::Unix { loc: loc.into_inner().into(), auth },\n\t\t}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/sxyazi/yazi/blob/8ebf930f1796ae2076b7d6b0c5e93a1002c18134/yazi-shared/src/url/buf.rs#L115-L151","documentation":"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.","triggerScenarios":"Calling `url_buf.into_view(auth, data)` passing an auth whose kind is Regular, Sftp, or Hub instead of a view variant.","commonSituations":"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).","solutions":["Pass an auth whose kind is a view variant; create it via the view-auth constructor or clone an existing view auth.","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.","Double-check where the AuthArc came from — physical URL auth is never view-kind."],"exampleFix":"// before\nurl.into_view(url.physical().auth().clone(), data)?;\n// after\nlet view_auth = AuthArc::view(url.physical().auth().clone());\nurl.into_view(view_auth, data)?;","handlingStrategy":"type-guard","validationCode":"if !auth.kind.is_view() {\n    return Err(anyhow!(\"into_view needs a view-kind auth\"));\n}","typeGuard":"fn is_view_auth(auth: &AuthArc) -> bool { auth.kind.is_view() }","tryCatchPattern":"// match on result\nlet viewed = url.into_view(auth, data).context(\"converting to view URL\")?;","preventionTips":["Keep physical auth and view auth in separate variables/paths to avoid mixing them.","Assert auth.kind.is_view() in debug builds before view conversions.","Create view auths only through the dedicated view-auth helpers."],"tags":["url","auth","view","rust"],"backgroundTag":"invalid-argument-value","analyzedSha":"8ebf930f1796ae2076b7d6b0c5e93a1002c18134","analyzedAt":"2026-09-09T22:26:16.379Z","contentChangedAt":"2026-09-09T22:26:16.379Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}