{"record":{"id":"3a27a7c9e5df2178","repo":"microsoft/TypeScript","slug":"task-0-task-1-join-failed-result-s","errorCode":null,"errorMessage":"${task[0]} ${task[1].join(\" \")} failed: ${result.stderr && \"stderr: \" + result.stderr.toString()}${result.stdout && \"\\nstdout: \" + result.stdout.toString()}","messagePattern":"(.+?) (.+?) failed: (.+?)(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/run-sequence.mjs","lineNumber":14,"sourceCode":"import assert from \"assert\";\r\nimport cp from \"child_process\";\r\n\r\n/**\r\n * @param {[string, string[]][]} tasks\r\n * @param {cp.SpawnSyncOptions} opts\r\n * @returns {string}\r\n */\r\nexport function runSequence(tasks, opts = { timeout: 100000, shell: true }) {\r\n    let lastResult;\r\n    for (const task of tasks) {\r\n        console.log(`${task[0]} ${task[1].join(\" \")}`);\r\n        const result = cp.spawnSync(task[0], task[1], opts);\r\n        if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(\" \")} failed: ${result.stderr && \"stderr: \" + result.stderr.toString()}${result.stdout && \"\\nstdout: \" + result.stdout.toString()}`);\r\n        console.log(result.stdout && result.stdout.toString());\r\n        lastResult = result;\r\n    }\r\n    const out = lastResult?.stdout?.toString();\r\n    assert(out !== undefined);\r\n    return out;\r\n}\r\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/scripts/run-sequence.mjs#L1-L22","documentation":"runSequence executes a list of [cmd, args] tasks via spawnSync (default 100s timeout, shell:true) and throws as soon as one exits with non-zero status, embedding that task's stderr and stdout in the error message.","triggerScenarios":"Any child process in the sequence exits non-zero: a real failure, a missing binary on PATH, or a timeout/signal kill (which also surfaces as non-zero status).","commonSituations":"An orchestrated release/build script where an inner step (test, lint, pack) fails; PATH not set up for the spawned binary.","solutions":["Read the embedded stderr/stdout in the error to identify the failing command and its real cause.","Reproduce by running that exact command manually in the same environment.","Fix the underlying tool/config and ensure the binary is on PATH.","If the 100s default timeout is too short, pass a larger `opts.timeout` from the caller."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate each command exists before spawning.\nimport { whichSync } from \"child_process\";\nfor (const [cmd] of tasks) {\n  if (!whichSync(cmd)) throw new Error(`Command not found on PATH: ${cmd}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return runSequence(tasks, opts);\n} catch (e) {\n  // re-throw with the failing task clearly identified; do not retry unchanged.\n  throw new Error(`runSequence step failed: ${e.message}`, { cause: e });\n}","preventionTips":["Log each task line before spawning (the helper already does) so the failing step is obvious.","Set opts.timeout high enough for the slowest task; the 100s default is aggressive.","Reproduce the failing sub-command manually before changing anything."],"tags":["build","subprocess","orchestration","release"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}