{"record":{"id":"3bc63e9061520c26","repo":"microsoft/typescript-go","slug":"vendorjsonrpcsrc-is-not-installed-run-npm-ci","errorCode":null,"errorMessage":"${vendorJsonrpcSrc} is not installed; run `npm ci` first.","messagePattern":"(.+?) is not installed; run `npm ci` first\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":588,"sourceCode":"    name: \"generate:ast\",\r\n    description: \"Generates AST and encoder files from ast.json.\",\r\n    run: () => $`node --experimental-strip-types --no-warnings ./_scripts/generate.ts`,\r\n});\r\n\r\n// ── Vendored npm dependencies ───────────────────────────────────\r\n\r\nconst vendorJsonrpcDir = \"_packages/native-preview/vendor/vscode-jsonrpc\";\r\nconst vendorJsonrpcSrc = \"node_modules/vscode-jsonrpc\";\r\n// Files copied verbatim from the installed vscode-jsonrpc package into the\r\n// vendored copy. Only the runtime files needed by the `#vscode-jsonrpc/node`\r\n// import (lib + typings + package.json) plus license/readme are vendored.\r\nconst vendorJsonrpcFiles = [\"package.json\", \"README.md\", \"License.txt\", \"lib\", \"typings\"];\r\n\r\nasync function runGenerateVendor() {\r\n    const src = path.join(__dirname, vendorJsonrpcSrc);\r\n    const dest = path.join(__dirname, vendorJsonrpcDir);\r\n    if (!fs.existsSync(src)) {\r\n        throw new Error(`${vendorJsonrpcSrc} is not installed; run \\`npm ci\\` first.`);\r\n    }\r\n    await rimraf(dest);\r\n    await fs.promises.mkdir(dest, { recursive: true });\r\n    for (const file of vendorJsonrpcFiles) {\r\n        await cpRecursive(path.join(src, file), path.join(dest, file));\r\n    }\r\n}\r\n\r\nexport const generateVendor = task({\r\n    name: \"generate:vendor\",\r\n    description: \"Updates the vendored copy of vscode-jsonrpc from node_modules.\",\r\n    run: runGenerateVendor,\r\n});\r\n\r\nconst coverageDir = path.join(__dirname, \"coverage\");\r\n\r\nconst ensureCoverageDirExists = memoize(() => {\r\n    if (options.coverage) {\r","sourceCodeStart":570,"sourceCodeEnd":606,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/Herebyfile.mjs#L570-L606","documentation":"During StopTracing, after all per-checker type dumps succeed, the remaining buffered events plus the closing ']\\n' are appended to the trace file via fs.AppendFile. Failure here means the trace JSON array was never closed, so the file on disk is syntactically incomplete and will not load in chrome://tracing or perfetto. Note the ordering: a previously recorded flushErr is returned instead (earlier branch), so this specific error only fires when the final append itself fails.","triggerScenarios":"StopTracing on a session whose final append fails: disk full at close time, trace file removed or made read-only during the run, FS errors on append, or a custom vfs.FS whose AppendFile cannot extend the file. Small sessions that never crossed flushThreshold write their entire content here, so even short runs can hit it.","commonSituations":"Disk quota exhausted exactly at teardown; trace directory cleaned up by a concurrent job before the process exits; NFS/network filesystem append failures; permissions changed mid-run.","solutions":["Verify disk space and directory permissions at traceDir, then re-run the traced operation — the current file lacks the closing bracket and is unusable.","Confirm the trace file still exists and is appendable by the same user throughout the session (no external truncation).","Validate finished traces before analysis: a quick check that the file ends with ']\\n' catches this class of corruption.","Use a local, writable filesystem for traceDir rather than network mounts."],"exampleFix":"// before\n_ = tr.StopTracing() // error ignored, broken trace.json\n\n// after\nif err := tr.StopTracing(); err != nil {\n\treturn fmt.Errorf(\"trace session failed (output may be incomplete): %w\", err)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := tr.StopTracing(); err != nil {\n\tif strings.Contains(err.Error(), \"failed to write trace file\") {\n\t\tlog.Printf(\"trace JSON not finalized (missing closing bracket): %v\", err)\n\t}\n\treturn err // or degrade: continue without trace analysis\n}","preventionTips":["Verify traceDir writability at teardown time too, not just startup — keep the mount alive until the process exits.","Free disk headroom before large traced runs.","After each run, check the trace file ends with ']\\n' before feeding it to analysis tools.","Avoid network filesystems for trace output; appends are failure-prone there."],"tags":["tracing","io","teardown","corruption"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}