zed-industries/zed · error · anyhow::Error
Default prettier is not installed and cannot be started
Error message
Default prettier is not installed and cannot be started
What it means
When a project has no prettier in node_modules, Zed falls back to a globally managed "default prettier" installed into default_prettier_dir(). start_default_server inspects the PrettierInstallation state; NotInstalled with no pending installation_task means there is nothing to start or await right now (crates/project/src/prettier_store.rs:335), so it bails.
Source
Thrown at crates/project/src/prettier_store.rs:335
fn start_default_prettier(
node: NodeRuntime,
worktree_id: Option<WorktreeId>,
cx: &mut Context<PrettierStore>,
) -> Task<anyhow::Result<PrettierTask>> {
cx.spawn(async move |prettier_store, cx| {
let installation_task = prettier_store.read_with(cx, |prettier_store, _| {
match &prettier_store.default_prettier.prettier {
PrettierInstallation::NotInstalled {
installation_task, ..
} => ControlFlow::Continue(installation_task.clone()),
PrettierInstallation::Installed(default_prettier) => {
ControlFlow::Break(default_prettier.clone())
}
}
})?;
match installation_task {
ControlFlow::Continue(None) => {
anyhow::bail!("Default prettier is not installed and cannot be started")
}
ControlFlow::Continue(Some(installation_task)) => {
log::info!("Waiting for default prettier to install");
if let Err(e) = installation_task.await {
prettier_store.update(cx, |project, _| {
if let PrettierInstallation::NotInstalled {
installation_task,
attempts,
..
} = &mut project.default_prettier.prettier
{
*installation_task = None;
*attempts += 1;
}
})?;
anyhow::bail!(
"Cannot start default prettier due to its installation failure: {e:#}"
);View on GitHub (pinned to f4178619ac)
Solutions
- Install prettier in the project itself (npm i -D prettier) - Zed prefers node_modules prettier and skips the default entirely
- Verify node -v and npm -v work in the environment Zed launches from, then retrigger formatting or restart Zed so a fresh install task starts
- If it keeps landing here, inspect the paired "Cannot start default prettier due to its installation failure" error for the root cause
Example fix
# before: project has no prettier, default install unavailable format on save -> "Default prettier is not installed and cannot be started" # after npm install --save-dev prettier # formatting now uses ./node_modules/prettier
Defensive patterns
Strategy: fallback
Validate before calling
# shell pre-check before relying on the default prettier [ -d node_modules/prettier ] && echo "local prettier present" || npm install --save-dev prettier
Try / catch
match start_default_prettier(node, worktree_id, cx).await {
Ok(server) => server,
Err(e) if e.to_string().contains("Default prettier is not installed") => {
// fall back to the language server's built-in formatter
format_via_language_server(buffer, cx).await
}
Err(e) => return Err(e),
} Prevention
- Commit prettier as a project devDependency so the global default never matters
- Verify node/npm availability before selecting prettier as the default formatter
When it happens
Trigger: Triggering prettier formatting while default_prettier is PrettierInstallation::NotInstalled with installation_task == None - e.g. a previous auto-install failed and the store cleared the task and bumped its attempts counter, or installation was never started for this worktree.
Common situations: Node/npm missing or offline during the first format of a project; retrying format right after a failed auto-install; formatting requested while the store is still initializing.
Related errors
- Cannot start default prettier due to its installation failur
- GitHub Copilot native language server binary was not install
- Failed to install or start judge proxy (exit {result.return_
- copilot was not started because of an error: {error}
- unsupported Copilot language server platform: {platform}
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/a08f334ddd418c0c.
Report an issue: GitHub.