{"record":{"id":"53462af083fd666a","repo":"earendil-works/pi","slug":"timeout","errorCode":"timeout","errorMessage":"Invalid timeout: must be a finite number of seconds","messagePattern":"Invalid timeout: must be a finite number of seconds","errorType":"validation","errorClass":"ExecutionError","httpStatus":null,"severity":"error","filePath":"packages/agent/src/harness/env/nodejs.ts","lineNumber":41,"sourceCode":"\tExecutionError,\n\terr,\n\tFileError,\n\ttype FileInfo,\n\ttype FileKind,\n\tok,\n\ttype Result,\n\ttype ShellExecOptions,\n\ttoError,\n} from \"../types.ts\";\n\nconst MAX_TIMEOUT_MS = 2_147_483_647;\nconst MAX_TIMEOUT_SECONDS = MAX_TIMEOUT_MS / 1000;\nconst EXIT_STDIO_GRACE_MS = 100;\n\nfunction resolveTimeoutMs(timeout: number | undefined): Result<number | undefined, ExecutionError> {\n\tif (timeout === undefined) return ok(undefined);\n\tif (!Number.isFinite(timeout) || timeout <= 0) {\n\t\treturn err(new ExecutionError(\"timeout\", \"Invalid timeout: must be a finite number of seconds\"));\n\t}\n\n\tconst timeoutMs = timeout * 1000;\n\tif (timeoutMs > MAX_TIMEOUT_MS) {\n\t\treturn err(new ExecutionError(\"timeout\", `Invalid timeout: maximum is ${MAX_TIMEOUT_SECONDS} seconds`));\n\t}\n\treturn ok(timeoutMs);\n}\n\nfunction resolvePath(cwd: string, path: string): string {\n\tlet normalized = path;\n\tif (normalized === \"~\") {\n\t\tnormalized = homedir();\n\t} else if (normalized.startsWith(\"~/\") || (process.platform === \"win32\" && normalized.startsWith(\"~\\\\\"))) {\n\t\tnormalized = join(homedir(), normalized.slice(2));\n\t} else if (normalized.startsWith(\"file://\")) {\n\t\ttry {\n\t\t\tnormalized = fileURLToPath(normalized);","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/agent/src/harness/env/nodejs.ts#L23-L59","documentation":"Validation error from resolveTimeoutMs: the caller-supplied shell-exec timeout option is not a finite positive number of seconds (NaN, Infinity, zero, or negative). It is converted into an ExecutionError of kind 'timeout' before any child process is spawned, so an unusable timer never reaches setTimeout.","triggerScenarios":"Thrown at packages/agent/src/harness/env/nodejs.ts:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a finite number of seconds as the timeout."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}