zed-industries/zed · error
Invalid kernelspec directory: {path:?}
Error message
Invalid kernelspec directory: {path:?} What it means
Raised in read_kernelspec_at when the supplied kernelspec directory path has no final path component (its file_name() is None), e.g. it is the filesystem root or ends in `..`. Without a file name the Jupyter kernel name cannot be derived, so the directory is rejected as invalid before any filesystem checks run.
Source
Thrown at crates/repl/src/kernels/native_kernel.rs:317
impl Drop for NativeRunningKernel {
fn drop(&mut self) {
std::fs::remove_file(&self.connection_path).ok();
self.kill();
}
}
async fn read_kernelspec_at(
// Path should be a directory to a jupyter kernelspec, as in
// /usr/local/share/jupyter/kernels/python3
kernel_dir: PathBuf,
fs: &dyn Fs,
) -> Result<LocalKernelSpecification> {
let path = kernel_dir;
let kernel_name = if let Some(kernel_name) = path.file_name() {
kernel_name.to_string_lossy().into_owned()
} else {
anyhow::bail!("Invalid kernelspec directory: {path:?}");
};
if !fs.is_dir(path.as_path()).await {
anyhow::bail!("Not a directory: {path:?}");
}
let expected_kernel_json = path.join("kernel.json");
let spec = fs.load(expected_kernel_json.as_path()).await?;
let spec = serde_json::from_str::<JupyterKernelspec>(&spec)?;
Ok(LocalKernelSpecification {
name: kernel_name,
path,
kernelspec: spec,
})
}
/// Read a directory of kernelspec directoriesView on GitHub (pinned to f4178619ac)
Solutions
- Verify the kernelspec directory path points at a named subdirectory (e.g. .../kernels/python3)
- Reinstall the kernel so a valid kernelspec directory exists
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/repl/src/kernels/native_kernel.rs:317 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/cfb27a50894b8c36.
Report an issue: GitHub.