{"record":{"id":"9751b7fe25c3f6a4","repo":"withastro/astro","slug":"timeout","errorCode":null,"errorMessage":"Timeout","messagePattern":"Timeout","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/create-astro/src/shell.ts","lineNumber":71,"sourceCode":"\ttry {\n\t\tconst [resolvedCommand, resolvedFlags] = resolveCommand(command, flags);\n\t\tchild = spawn(resolvedCommand, resolvedFlags, {\n\t\t\tcwd: opts.cwd,\n\t\t\tstdio: opts.stdio,\n\t\t\ttimeout: opts.timeout,\n\t\t});\n\t\tconst done = new Promise<void>((resolve, reject) => {\n\t\t\tchild.once('error', reject);\n\t\t\tchild.once('close', () => resolve());\n\t\t});\n\t\t[stdout, stderr] = await Promise.all([text(child.stdout), text(child.stderr), done]);\n\t} catch (e) {\n\t\tconst message = e instanceof Error ? e.message : stderr || 'Unknown error';\n\t\tthrow new Error(message);\n\t}\n\tconst { exitCode } = child;\n\tif (exitCode === null) {\n\t\tthrow new Error('Timeout');\n\t}\n\tif (exitCode !== 0) {\n\t\tthrow new Error(stderr || `Process exited with code ${exitCode}`);\n\t}\n\treturn { stdout, stderr, exitCode };\n}\n","sourceCodeStart":53,"sourceCodeEnd":78,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/create-astro/src/shell.ts#L53-L78","documentation":"create-astro's tiny execa-like shell() helper spawns child processes (for example npm install during scaffolding) with an optional timeout backed by Node's spawn. If the child is killed by the timeout signal, its exitCode is still null after the close event and the helper reports 'Timeout'. In practice this means the spawned command exceeded its allotted time — usually dependency installation on a slow network or machine.","triggerScenarios":"shell('npm', ['install'], { timeout }) where the install exceeds the timeout; a spawned command that blocks waiting on stdin (interactive prompt) in a non-TTY environment; extremely slow registries or proxies.","commonSituations":"npm create astro@latest on slow connections where npm install cannot finish in time; commands prompting for input where no TTY exists; calling shell() directly with a tight timeout.","solutions":["Retry — transient network slowness is the most common cause","Skip install during scaffolding (--no-install) and run npm install manually afterwards without a timeout","If you call shell() yourself, pass a larger opts.timeout (milliseconds)","Make sure the spawned command cannot block on a prompt (pass --yes / CI flags)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n\tawait shell('npm', ['install', '--no-fund', '--no-audit'], { timeout: 60_000, cwd });\n} catch (e) {\n\tif (e instanceof Error && e.message === 'Timeout') {\n\t\t// slow install: retry once with a much larger budget\n\t\tawait shell('npm', ['install', '--no-fund', '--no-audit'], { timeout: 300_000, cwd });\n\t} else {\n\t\tthrow e;\n\t}\n}","preventionTips":["Pass non-interactive flags (--yes, --no-fund, --no-audit) so spawned commands never block on prompts","Size opts.timeout to the slowest realistic install (CI + cold npm cache), not the fastest","Use create-astro's --no-install and run the package manager yourself when networks are slow"],"tags":["create-astro","cli","child-process","timeout","npm-install"],"backgroundTag":"child-process-timeout","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}