{"record":{"id":"fd201cb16e3e77e8","repo":"denoland/deno","slug":"invalid-yaml-e","errorCode":null,"errorMessage":"Invalid YAML: {e}","messagePattern":"Invalid YAML: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/util/pnpm_workspace.rs","lineNumber":252,"sourceCode":"}\n\nfn string_map_to_value(map: &IndexMap<String, String>) -> CstInputValue {\n  CstInputValue::Object(\n    map\n      .iter()\n      .map(|(k, v)| (k.clone(), CstInputValue::String(v.clone())))\n      .collect(),\n  )\n}\n\n// ===========================================================================\n// pnpm-workspace.yaml parsing (via the yaml_parser CST already used by\n// `deno fmt`, so no new YAML dependency is introduced).\n// ===========================================================================\n\nfn parse_pnpm_workspace(text: &str) -> Result<PnpmWorkspace, AnyError> {\n  let tree = yaml_parser::parse(text)\n    .map_err(|e| deno_core::anyhow::anyhow!(\"Invalid YAML: {e}\"))?;\n  let Some(root) = Root::cast(tree) else {\n    return Ok(PnpmWorkspace::default());\n  };\n  let Some(block_map) = root\n    .documents()\n    .next()\n    .and_then(|doc: Document| doc.block())\n    .and_then(|block| block.block_map())\n  else {\n    return Ok(PnpmWorkspace::default());\n  };\n\n  let mut result = PnpmWorkspace::default();\n  for entry in block_map.entries() {\n    let Some(key) = entry.key().map(|k| k.syntax().clone()) else {\n      continue;\n    };\n    let Some(key_name) = scalar_text(&key) else {","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/util/pnpm_workspace.rs#L234-L270","documentation":"Deno reads pnpm-workspace.yaml to support pnpm-style workspaces and catalogs, parsing it with the same yaml_parser CST already used by `deno fmt` (parse_pnpm_workspace, cli/util/pnpm_workspace.rs:249-252). Any YAML syntax error — bad indentation, tabs, unclosed quotes or flow collections, duplicate keys — aborts loading with \"Invalid YAML: {parser error}\", including the position the parser reported.","triggerScenarios":"Any workspace-root pnpm-workspace.yaml that fails to parse, hit as soon as Deno loads config (deno install/task/run/check) in that directory; hand-edited catalog blocks with misaligned indentation are the classic case.","commonSituations":"Merging catalog entries by hand; smart quotes or tabs pasted from chat/docs; renaming keys and breaking list syntax; YAML files edited by tools that emit single quotes oddly.","solutions":["Fix the reported position: the {e} in the message carries the parser's line/column detail.","Validate the file before retrying: `pnpm install` (pnpm's own parser) or a YAML linter / yq pnpm-workspace.yaml.","Check for tabs (YAML requires spaces), smart quotes, and duplicate top-level keys."],"exampleFix":"# pnpm-workspace.yaml — before\npackages:\n  - 'apps/*'\ncatalog:\n  react: ^18.2.0\n    lodash: ^4.17.21   # wrong indentation\n\n# after\ncatalog:\n  react: ^18.2.0\n  lodash: ^4.17.21","handlingStrategy":"validation","validationCode":"# Validate pnpm-workspace.yaml before running deno in the workspace\nif command -v pnpm >/dev/null; then pnpm install --lockfile-only >/dev/null \\\n  || { echo 'pnpm-workspace.yaml is invalid'; exit 1; }; fi\ndeno task build","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use spaces (never tabs) and consistent indentation when editing catalog/workspace YAML.","Lint the file (yq, a YAML extension, or pnpm itself) after every hand edit.","Beware smart quotes and copy-paste from rich-text sources."],"tags":["yaml","pnpm","workspace","config"],"backgroundTag":"config-parse-error","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}