{"record":{"id":"a03df4000f19217c","repo":"garrytan/gstack","slug":"timed-out-waiting-for-another-instance-to-start-th","errorCode":null,"errorMessage":"Timed out waiting for another instance to start the server","messagePattern":"Timed out waiting for another instance to start the server","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/cli.ts","lineNumber":477,"sourceCode":"    console.error(`[browse] Run '/open-gstack-browser' to restart.`);\n    process.exit(1);\n  }\n\n  // Ensure state directory exists before lock acquisition (lock file lives there)\n  ensureStateDir(config);\n\n  // Acquire lock to prevent concurrent restart races (TOCTOU)\n  const releaseLock = acquireServerLock();\n  if (!releaseLock) {\n    // Another process is starting the server — wait for it\n    console.error('[browse] Another instance is starting the server, waiting...');\n    const start = Date.now();\n    while (Date.now() - start < MAX_START_WAIT) {\n      const freshState = readState();\n      if (freshState && await isServerHealthy(freshState.port)) return freshState;\n      await Bun.sleep(200);\n    }\n    throw new Error('Timed out waiting for another instance to start the server');\n  }\n\n  try {\n    // Re-read state under lock in case another process just started the server\n    const freshState = readState();\n    if (freshState && await isServerHealthy(freshState.port)) {\n      return freshState;\n    }\n\n    // Kill the old server to avoid orphaned chromium processes\n    if (state && state.pid) {\n      await killServer(state.pid);\n    }\n    if (flags?.redactedProxyUrl && flags.redactedProxyUrl !== '<no proxy>') {\n      console.error(`[browse] Starting server with proxy ${flags.redactedProxyUrl}${flags.headed ? ' (headed)' : ''}...`);\n    } else if (flags?.headed) {\n      console.error('[browse] Starting server in headed mode...');\n    } else {","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/cli.ts#L459-L495","documentation":"Error \"Timed out waiting for another instance to start the server\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/cli.ts:477 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}