{"record":{"id":"483a6f7b8ddc0750","repo":"santifer/career-ops","slug":"describegitcommand-args-timed-out-after-time","errorCode":null,"errorMessage":"${describeGitCommand(args)} timed out after ${timeoutSeconds(timeout)}s. If your network is slow, retry or set ${gitTimeoutEnvVar(args)} to a larger value.","messagePattern":"(.+?) timed out after (.+?)s\\. If your network is slow, retry or set (.+?) to a larger value\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"update-system.mjs","lineNumber":519,"sourceCode":"function isTimeoutLikeError(err) {\n  return err?.code === 'ETIMEDOUT' || err?.signal === 'SIGTERM';\n}\n\nfunction timeoutSeconds(timeout) {\n  return Math.round(timeout / 1000);\n}\n\nfunction gitTimeoutEnvVar(args) {\n  return args[0] === 'fetch' ? 'CAREER_OPS_GIT_FETCH_TIMEOUT_MS' : 'CAREER_OPS_GIT_TIMEOUT_MS';\n}\n\nexport function gitIn(root, ...args) {\n  const timeout = gitTimeoutMs(args);\n  try {\n    return execFileSync('git', args, { cwd: root, encoding: 'utf-8', timeout }).trim();\n  } catch (err) {\n    if (isTimeoutLikeError(err)) {\n      throw new Error(`${describeGitCommand(args)} timed out after ${timeoutSeconds(timeout)}s. If your network is slow, retry or set ${gitTimeoutEnvVar(args)} to a larger value.`);\n    }\n    throw err;\n  }\n}\n\nfunction git(...args) {\n  return gitIn(ROOT, ...args);\n}\n\n/**\n * git(), but with the child's stderr piped instead of inherited.\n *\n * execFileSync inherits stderr by default, so a command whose failure is\n * expected and handled still prints git's raw error to the console. Use this\n * where a non-zero exit is a normal outcome the caller reports itself.\n *\n * @param {...string} args - git arguments.\n * @returns {string} Trimmed stdout.","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/update-system.mjs#L501-L537","documentation":"gitIn() runs a git subcommand via execFileSync with a configurable timeout (CAREER_OPS_GIT_TIMEOUT_MS, or CAREER_OPS_GIT_FETCH_TIMEOUT_MS for fetch). If the child does not exit within the timeout, execFileSync kills it and the error is detected as timeout-like; gitIn throws an Error naming the command, the elapsed seconds, and the env var to raise. This prevents update-system.mjs from hanging on a slow network.","triggerScenarios":"Running update-system.mjs (which calls git fetch/pull/clone) over a slow or stalled network connection that exceeds the default timeout; a hung git credential prompt blocking stdin; an unreachable git remote timing out at TCP level.","commonSituations":"Slow/constrained network (mobile, throttled CI, cross-continent git host); a credential helper that blocks waiting for input with stdio not inherited; a very large fetch with many objects on a slow link; a temporarily down git hosting provider.","solutions":["Raise the timeout via env var: CAREER_OPS_GIT_FETCH_TIMEOUT_MS=300000 node update-system.mjs apply (5 min).","Check connectivity to the remote: git ls-remote <url> to isolate network vs. auth issues.","If a credential prompt is hanging, configure a non-interactive credential helper or cache.","Retry when the network recovers; for a one-time large fetch, run git fetch manually first."],"exampleFix":"# before: default timeout too short for slow link\nnode update-system.mjs apply  # -> timed out after 60s\n\n# after: raise the fetch timeout\nCAREER_OPS_GIT_FETCH_TIMEOUT_MS=300000 node update-system.mjs apply","handlingStrategy":"retry","validationCode":"function resolveGitTimeout(args) {\n  return args[0] === 'fetch'\n    ? Number(process.env.CAREER_OPS_GIT_FETCH_TIMEOUT_MS) || 60_000\n    : Number(process.env.CAREER_OPS_GIT_TIMEOUT_MS) || 60_000;\n}\nif (resolveGitTimeout(['fetch']) < 120000) {\n  console.warn('Consider raising CAREER_OPS_GIT_FETCH_TIMEOUT_MS on slow networks');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runUpdate();\n} catch (err) {\n  if (err.message.includes('timed out')) {\n    const m = err.message.match(/set (\\S+) to a larger value/);\n    console.error(`${err.message}\\nRetrying with larger timeout.`);\n    if (m) process.env[m[1]] = String(300000);\n    await runUpdate();\n  } else throw err;\n}","preventionTips":["Set CAREER_OPS_GIT_FETCH_TIMEOUT_MS generously in CI and slow-network environments (e.g. 300000).","Ensure git credential helpers are non-interactive to avoid stdin-block hangs.","Pre-warm large fetches with a manual `git fetch` outside the timeout-sensitive update path."],"tags":["network","git","timeout","update-system","configuration"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}