{"record":{"id":"1c84b39173609890","repo":"zed-industries/zed","slug":"path-path-to-check-is-the-workspace-root-for-p","errorCode":null,"errorMessage":"Path {path_to_check:?} is the workspace root for project in {closest_package_json_path:?}, but it has no prettier installed","messagePattern":"Path (.+?) is the workspace root for project in (.+?), but it has no prettier installed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/prettier/src/prettier.rs","lineNumber":132,"sourceCode":"                } else {\n                    match &closest_package_json_path {\n                        None => closest_package_json_path = Some(path_to_check.clone()),\n                        Some(closest_package_json_path) => {\n                            match package_json_contents.get(\"workspaces\") {\n                                Some(serde_json::Value::Array(workspaces)) => {\n                                    let subproject_path = closest_package_json_path.strip_prefix(&path_to_check).expect(\"traversing path parents, should be able to strip prefix\");\n                                    if workspaces.iter().filter_map(|value| {\n                                        if let serde_json::Value::String(s) = value {\n                                            Some(s.clone())\n                                        } else {\n                                            log::warn!(\"Skipping non-string 'workspaces' value: {value:?}\");\n                                            None\n                                        }\n                                    }).any(|workspace_definition| {\n                                        workspace_definition == subproject_path.to_string_lossy() || PathMatcher::new(&[workspace_definition], PathStyle::local()).ok().is_some_and(\n                                            |path_matcher| RelPath::new(subproject_path, PathStyle::local()).is_ok_and(|path|  path_matcher.is_match(path)))\n                                    }) {\n                                        anyhow::ensure!(has_prettier_in_node_modules(fs, &path_to_check).await?,\n                                            \"Path {path_to_check:?} is the workspace root for project in \\\n                                            {closest_package_json_path:?}, but it has no prettier installed\"\n                                        );\n                                        log::info!(\n                                            \"Found prettier path {path_to_check:?} in the workspace \\\n                                            root for project in {closest_package_json_path:?}\"\n                                        );\n                                        return Ok(ControlFlow::Continue(Some(path_to_check)));\n                                    } else {\n                                        log::warn!(\n                                            \"Skipping path {path_to_check:?} workspace root with \\\n                                            workspaces {workspaces:?} that have no prettier installed\"\n                                        );\n                                    }\n                                }\n                                Some(unknown) => log::error!(\n                                    \"Failed to parse workspaces for {path_to_check:?} from package.json, \\\n                                    got {unknown:?}. Skipping.\"","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/prettier/src/prettier.rs#L114-L150","documentation":"While walking up from the buffer looking for prettier, locate_prettier_installation reached the package.json that declares workspaces (the workspace root) without finding a prettier installation in any node_modules along the way. The root itself has no prettier dependency, so formatting cannot proceed with the project's prettier.","triggerScenarios":"Thrown at crates/prettier/src/prettier.rs:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install prettier in the workspace root: `npm install --save-dev prettier` at the root package.json","Or add prettier to the specific sub-project being formatted","Run npm/yarn/pnpm install to make sure node_modules is populated after adding the dependency"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}