{"record":{"id":"7d5fb34227924bf9","repo":"garrytan/gstack","slug":"design-daemon-failed-to-start-within-max-start-w","errorCode":null,"errorMessage":"Design daemon failed to start within ${MAX_START_WAIT_MS}ms.\nStartup log (${logPath}):\n${tail || \"(empty)\"}","messagePattern":"Design daemon failed to start within (.+?)ms\\.\nStartup log \\((.+?)\\):\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"design/src/daemon-client.ts","lineNumber":309,"sourceCode":"  const deadline = Date.now() + MAX_START_WAIT_MS;\n  while (Date.now() < deadline) {\n    const fresh = readStateFile(opts.stateFile);\n    if (fresh) {\n      const h = await healthCheck(fresh.port);\n      if (h) return fresh.port;\n    }\n    await delay(POLL_INTERVAL_MS);\n  }\n\n  // Timed out — surface the startup log so the user sees the actual error\n  // instead of \"daemon failed silently.\"\n  let tail = \"\";\n  try {\n    tail = fs.readFileSync(logPath, \"utf-8\").trim();\n  } catch {\n    // log file may not exist\n  }\n  throw new Error(\n    `Design daemon failed to start within ${MAX_START_WAIT_MS}ms.\\n` +\n      `Startup log (${logPath}):\\n${tail || \"(empty)\"}`,\n  );\n}\n\nasync function gracefulShutdownExistingDaemon(port: number): Promise<void> {\n  try {\n    await fetch(`http://127.0.0.1:${port}/shutdown`, {\n      method: \"POST\",\n      signal: AbortSignal.timeout(2000),\n    });\n  } catch {\n    // Daemon may have already exited or be unresponsive — fall through\n    // to the SIGTERM path with identity verification.\n  }\n}\n\n/**","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/design/src/daemon-client.ts#L291-L327","documentation":"Error \"Design daemon failed to start within ${MAX_START_WAIT_MS}ms.\nStartup log (${logPath}):\n${tail || \"(empty)\"}\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at design/src/daemon-client.ts:309 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"}