{"record":{"id":"40512f54807b0ab1","repo":"paperclipai/paperclip","slug":"failed-to-create-remote-workspace-directory-rem","errorCode":null,"errorMessage":"Failed to create remote workspace directory '${remoteCwd}': mkdir exited with code ${exitCode}","messagePattern":"Failed to create remote workspace directory '(.+?)': mkdir exited with code (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/sandbox-providers/modal/src/plugin.ts","lineNumber":264,"sourceCode":"    'if [ -f \"$HOME/.profile\" ]; then . \"$HOME/.profile\" >/dev/null 2>&1 || true; fi',\n    'if [ -f \"$HOME/.bash_profile\" ]; then . \"$HOME/.bash_profile\" >/dev/null 2>&1 || true; elif [ -f \"$HOME/.bashrc\" ]; then . \"$HOME/.bashrc\" >/dev/null 2>&1 || true; fi',\n    'if [ -f \"$HOME/.zprofile\" ]; then . \"$HOME/.zprofile\" >/dev/null 2>&1 || true; fi',\n  ];\n  if (input.cwd) {\n    lines.push(`cd ${shellQuote(input.cwd)}`);\n  }\n  lines.push(finalLine);\n  return lines.join(\" && \");\n}\n\nasync function ensureRemoteWorkspace(sandbox: Sandbox, remoteCwd: string): Promise<void> {\n  // Use a one-shot exec to mkdir -p; Modal does not expose a direct\n  // filesystem mkdir helper and creating a file via `open()` does not create\n  // intermediate directories.\n  const proc = await sandbox.exec([\"sh\", \"-lc\", `mkdir -p ${shellQuote(remoteCwd)}`]);\n  const exitCode = await proc.wait();\n  if (exitCode !== 0) {\n    throw new Error(\n      `Failed to create remote workspace directory '${remoteCwd}': mkdir exited with code ${exitCode}`,\n    );\n  }\n}\n\nasync function stageStdin(sandbox: Sandbox, stdin: string, remotePath: string): Promise<void> {\n  const file = await sandbox.open(remotePath, \"w\");\n  try {\n    await file.write(new TextEncoder().encode(stdin));\n    await file.flush();\n  } finally {\n    await file.close().catch(() => undefined);\n  }\n}\n\nasync function deleteStdinPath(sandbox: Sandbox, remotePath: string): Promise<void> {\n  // Best-effort cleanup of the staged stdin file. We swallow errors because\n  // it is fine for the file to outlive the sandbox if it is going to be","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/packages/plugins/sandbox-providers/modal/src/plugin.ts#L246-L282","documentation":"Thrown by ensureRemoteWorkspace in the Modal sandbox provider. Fires when the one-shot exec that mkdirs the remote workspace directory exits non-zero, so the plugin cannot set up the workspace cwd before running commands.","triggerScenarios":"Thrown at packages/plugins/sandbox-providers/modal/src/plugin.ts:264 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions and path validity on the remote sandbox; create parent dirs or fix remoteCwd."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}