paperclipai/paperclip · error

Daytona post-upload command failed (exit ${result.exitCode ?

Error message

Daytona post-upload command failed (exit ${result.exitCode ?? "unknown"})${detail ? `: ${detail}` : ""}

What it means

Thrown during performSyncIn when a caller-supplied postUploadCommand run verbatim in the sandbox exits non-zero. The first non-zero exit or timeout aborts the remaining commands. The command runs with a structured cwd and no string rewrite, and the error includes the exit code and trimmed stdout detail.

Source

Thrown at packages/plugins/sandbox-providers/daytona/src/file-sync.ts:730

            timeoutSeconds,
            label: "post-upload command cwd symlink-escape guard",
          }),
      });
      cwd = command.cwd;
    }
    // C1/C3: run the command VERBATIM with a structured cwd (no string rewrite).
    // C4: first non-zero exit or timeout throws and aborts the remaining commands.
    const commandTimeoutSeconds =
      command.timeoutMs != null ? toTimeoutSeconds(command.timeoutMs) : timeoutSeconds;
    // `postUploadCommand` span: run one caller-supplied post-upload command.
    const result = await withProviderSpan({
      name: "postUploadCommand",
      run: () =>
        sandbox.process.executeCommand(command.command, cwd, undefined, commandTimeoutSeconds),
    });
    if ((result.exitCode ?? 1) !== 0) {
      const detail = (result.result ?? result.artifacts?.stdout ?? "").toString().trim();
      throw new Error(
        `Daytona post-upload command failed (exit ${result.exitCode ?? "unknown"})${detail ? `: ${detail}` : ""}`,
      );
    }
  }
}

export async function performSyncIn(input: {
  sandbox: Sandbox;
  operations: PluginSyncOperation[];
  remoteDir: string;
  timeoutSeconds: number;
}): Promise<PluginEnvironmentSyncResult> {
  const operations: PluginEnvironmentSyncResult["operations"] = [];
  for (const operation of input.operations) {
    let filesTransferred = 0;
    let bytesTransferred = 0;

    const fileMappings = operation.files.filter((mapping) => mapping.kind === "file");

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Read the exit code and stdout detail in the error to diagnose the command failure.
  2. Run the postUploadCommand manually inside the sandbox (via SSH setup session) to reproduce and fix.
  3. Verify the cwd and that all uploaded files are present before the command runs.
  4. Increase timeoutMs for the command if it is timing out, or split long commands.

Example fix

// before: postUploadCommand fails on missing dep
config.postUploadCommands = [{ command: 'npm ci && npm run build', timeoutMs: 60000 }]
// after: install then build, verified cwd
config.postUploadCommands = [{ command: 'npm install --no-audit && npm run build', timeoutMs: 120000 }]
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await performSyncIn({ sandbox, operations, remoteDir, timeoutSeconds });
} catch (e) {
  if (e instanceof Error && e.message.includes('post-upload command failed')) {
    // read exit code + stdout; reproduce in SSH setup to fix the command
  }
  throw e;
}

Prevention

When it happens

Trigger: A syncIn operation specifies a postUploadCommand (e.g. build, install, lint) that fails inside the sandbox after files are uploaded. The command is executed verbatim via sandbox.process.executeCommand with the configured cwd and timeout.

Common situations: Post-upload build/install step fails (missing deps, syntax error, permission denied); command timeout exceeded; wrong cwd; command references files not yet present; shell differences between local and sandbox environments.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/5f81bf4c0f61070b. Report an issue: GitHub.