zed-industries/zed · error
url is not a file path: {}
Error message
url is not a file path: {} What it means
Guard in ns_url_to_path: fileSystemRepresentation on the NSURL returned null because the URL does not denote a local file (e.g. http(s): or other scheme), so it has no filesystem path. The message embeds the URL's absoluteString to show the offending input.
Source
Thrown at crates/gpui_macos/src/platform.rs:1574
if let Some(mut callback) = lock.will_open_menu.take() {
drop(lock);
callback();
platform.0.lock().will_open_menu.get_or_insert(callback);
}
}
}
extern "C" fn handle_dock_menu(this: &mut Object, _: Sel, _: id) -> id {
unsafe {
let platform = get_mac_platform(this);
let state = platform.0.lock();
if let Some(id) = state.dock_menu {
id
} else {
nil
}
}
}
unsafe fn ns_url_to_path(url: id) -> Result<PathBuf> {
let path: *mut c_char = msg_send![url, fileSystemRepresentation];
anyhow::ensure!(!path.is_null(), "url is not a file path: {}", unsafe {
CStr::from_ptr(url.absoluteString().UTF8String()).to_string_lossy()
});
Ok(PathBuf::from(OsStr::from_bytes(unsafe {
CStr::from_ptr(path).to_bytes()
})))
}
#[link(name = "Carbon", kind = "framework")]
unsafe extern "C" {
pub(super) fn TISCopyCurrentKeyboardLayoutInputSource() -> *mut Object;
pub(super) fn TISCopyCurrentKeyboardInputSource() -> *mut Object;
pub(super) fn TISGetInputSourceProperty(
inputSource: *mut Object,
propertyKey: *const c_void,View on GitHub (pinned to 9d272b0363)
Solutions
- Check the URL scheme (file:/conformant) before attempting path conversion
- Use NSURL.isFileURL as a precondition
- At the call site, skip or reject non-file URLs before calling this helper
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/gpui_macos/src/platform.rs:1507 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/a635ad7e19040f43.
Report an issue: GitHub.