{"record":{"id":"57625236d3585853","repo":"can1357/oh-my-pi","slug":"timed-out-waiting-timeoutsec-seconds-for-vibemo","errorCode":null,"errorMessage":"Timed out waiting ${timeoutSec} seconds for Vibemon VM ${sandbox.id} to become ready","messagePattern":"Timed out waiting (.+?) seconds for Vibemon VM (.+?) to become ready","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/tb/vmon.ts","lineNumber":70,"sourceCode":"\tif (!client) {\n\t\tclient = connect(config.url, { token: config.token || undefined });\n\t\tclients.set(key, client);\n\t}\n\treturn client;\n}\n\nasync function waitUntilRunning(sandbox: Sandbox, timeoutSec: number): Promise<void> {\n\tconst deadline = Date.now() + timeoutSec * 1_000;\n\twhile (Date.now() < deadline) {\n\t\tconst info = await sandbox.refresh();\n\t\tconst state = String(info.observed_state ?? info.status ?? \"\").toLowerCase();\n\t\tif (state === \"running\") return;\n\t\tif ([\"exited\", \"failed\", \"stopped\", \"terminated\"].includes(state)) {\n\t\t\tthrow new Error(`Vibemon VM ${sandbox.id} entered ${state} before becoming ready`);\n\t\t}\n\t\tawait Bun.sleep(250);\n\t}\n\tthrow new Error(`Timed out waiting ${timeoutSec} seconds for Vibemon VM ${sandbox.id} to become ready`);\n}\n\nasync function archiveDirectory(root: string): Promise<Blob> {\n\tconst entries: Record<string, Uint8Array> = {};\n\tconst visit = async (dir: string): Promise<void> => {\n\t\tfor (const entry of await fs.readdir(dir, { withFileTypes: true })) {\n\t\t\tconst absolute = path.join(dir, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait visit(absolute);\n\t\t\t} else if (entry.isFile()) {\n\t\t\t\tconst relative = path.relative(root, absolute).split(path.sep).join(\"/\");\n\t\t\t\tentries[relative] = new Uint8Array(await Bun.file(absolute).arrayBuffer());\n\t\t\t}\n\t\t}\n\t};\n\tawait visit(root);\n\treturn new Bun.Archive(entries, { compress: \"gzip\", level: 6 }).blob();\n}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/tb/vmon.ts#L52-L88","documentation":"waitUntilRunning polls the sandbox state every 250ms until timeoutSec elapses. If the sandbox never reports running (and never enters a terminal state) within that window, this timeout error is thrown naming the sandbox id and the configured timeout.","triggerScenarios":"Calling start() when the VM boots too slowly (image pull, slow host), or its state endpoint keeps reporting a non-running, non-terminal state (e.g. 'provisioning', 'pending') for longer than timeoutSec.","commonSituations":"Large VM image downloads on cold caches; overloaded host delaying startup; upstream API stuck reporting 'creating'; timeoutSec set too low for the environment.","solutions":["Increase the timeoutSec passed to start() to accommodate slow image pulls or hosts","Check the sandbox status endpoint/API for the sandbox id to see the stuck state","Pre-pull or pre-warm the VM image to remove cold-start latency","Retry the start; if the state is permanently stuck, terminate and recreate the sandbox"],"exampleFix":"// before\nawait vm.start({ timeoutSec: 30 });\n// after\nawait vm.start({ timeoutSec: 300 });","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await vm.start();\n} catch (err) {\n  if (/Timed out waiting \\d+ seconds for Vibemon VM/.test(err.message)) {\n    await terminateSandbox(vm.id); // clean up the stuck sandbox\n    const fresh = await createSandbox(config); // retry with a fresh instance\n    await fresh.start({ timeoutSec: 300 });\n    return fresh;\n  }\n  throw err;\n}","preventionTips":["Set timeoutSec generously (image pulls and cold hosts are slow)","Pre-warm/pre-pull VM images before batch runs","Always terminate sandboxes after a timeout so orphaned VMs don't accumulate"],"tags":["vm","timeout","startup"],"backgroundTag":"vm-startup-timeout","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}