{"record":{"id":"536f1edc4c8e1020","repo":"earendil-works/pi","slug":"spawn-error","errorCode":"spawn_error","errorMessage":"Working directory does not exist: ${cwd}\nCannot execute bash commands.","messagePattern":"Working directory does not exist: (.+?)\nCannot execute bash commands\\.","errorType":"error_code","errorClass":"ExecutionError","httpStatus":null,"severity":"error","filePath":"packages/agent/src/harness/env/nodejs.ts","lineNumber":383,"sourceCode":"\t}\n\n\tasync exec(\n\t\tcommand: string,\n\t\toptions?: ShellExecOptions,\n\t): Promise<Result<{ stdout: string; stderr: string; exitCode: number }, ExecutionError>> {\n\t\tif (options?.abortSignal?.aborted) return err(new ExecutionError(\"aborted\", \"aborted\"));\n\t\tconst timeoutMsResult = resolveTimeoutMs(options?.timeout);\n\t\tif (!timeoutMsResult.ok) return err(timeoutMsResult.error);\n\t\tconst timeoutMs = timeoutMsResult.value;\n\n\t\tconst cwd = options?.cwd ? resolvePath(this.cwd, options.cwd) : this.cwd;\n\t\tconst shellConfig = await getShellConfig(this.shellPath);\n\t\tif (!shellConfig.ok) return shellConfig;\n\t\ttry {\n\t\t\tawait access(cwd, constants.F_OK);\n\t\t} catch (error) {\n\t\t\tconst cause = toError(error);\n\t\t\treturn err(\n\t\t\t\tnew ExecutionError(\n\t\t\t\t\t\"spawn_error\",\n\t\t\t\t\t`Working directory does not exist: ${cwd}\\nCannot execute bash commands.`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\treturn await new Promise((resolvePromise) => {\n\t\t\tlet stdout = \"\";\n\t\t\tlet stderr = \"\";\n\t\t\tlet settled = false;\n\t\t\tlet timedOut = false;\n\t\t\tlet callbackError: ExecutionError | undefined;\n\t\t\tlet child: ReturnType<typeof spawn> | undefined;\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | undefined;\n\n\t\t\tconst onAbort = () => {","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/agent/src/harness/env/nodejs.ts#L365-L401","documentation":"Error \"Working directory does not exist: ${cwd}\nCannot execute bash commands.\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/agent/src/harness/env/nodejs.ts:383 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the working directory or fix the cwd path before running bash commands."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}