{"record":{"id":"fd201cb16e3e77e8","repo":"denoland/deno","slug":"invalid-yaml-e","errorCode":null,"errorMessage":"Invalid YAML: {e}","messagePattern":"Invalid YAML: (.+?)","errorType":"exception","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/89f33cbef296a2b287f323d42de54c871fa69c77/cli/util/pnpm_workspace.rs#L234-L270","documentation":"Thrown while parsing pnpm-workspace.yaml for a Deno workspace that uses pnpm. Deno reuses the yaml_parser CST that powers `deno fmt` (no new YAML dependency); when that parser reports a syntax error, this message wraps it and appends the parser's position details after the colon.","triggerScenarios":"Any `deno` CLI command that loads workspace config (`deno install`, `deno run`, `deno task`, ...) when pnpm-workspace.yaml contains invalid YAML: tab indentation, unbalanced quotes or flow brackets ([/]), duplicate keys rejected by the parser, or a stray control character.","commonSituations":"Hand-editing the `packages:` list and mixing tabs with spaces; pasting YAML from docs or chat that includes smart quotes; a merge leaving an unbalanced bracket; editors inserting a BOM.","solutions":["Fix the YAML syntax at the position reported after 'Invalid YAML:' (replace tabs with spaces, balance quotes and brackets)","Validate the file outside Deno, e.g. `pnpm install --lockfile-only` or a YAML linter, to confirm it parses","If the project does not actually use pnpm workspaces, delete or rename pnpm-workspace.yaml so Deno stops parsing it"],"exampleFix":"# pnpm-workspace.yaml (before) — tab-indented, invalid YAML\npackages:\n\t- \"apps/*\"\n\n# after — space-indented\npackages:\n  - \"apps/*\"","handlingStrategy":"validation","validationCode":"// CI pre-check: parse pnpm-workspace.yaml before any deno command\nimport { parse } from \"jsr:@std/yaml\";\ntry {\n  parse(await Deno.readText(\"pnpm-workspace.yaml\"));\n  console.log(\"pnpm-workspace.yaml OK\");\n} catch (e) {\n  console.error(`Invalid YAML: ${e}`);\n  Deno.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Indent pnpm-workspace.yaml with spaces only — tabs are invalid YAML indentation","Run a YAML linter or editor YAML plugin on the file in CI","A file that `pnpm install` accepts will also parse in Deno — validate with pnpm when in doubt"],"tags":["yaml","pnpm","workspace","config","cli"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}