paperclipai/paperclip · error

Daytona syncOut directory download failed for ${mapping.sour

Error message

Daytona syncOut directory download failed for ${mapping.sourcePath}: ${response?.error ?? "no response returned"}

What it means

Thrown during syncOut directory download when the Daytona fs.downloadFiles response for the remote tarball is missing or carries an `.error`. After creating a tar of the directory sandbox-side and attempting to download it to the host, a missing/errored response aborts before host-side extraction.

Source

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

      `cd ${shellQuote(mapping.sourcePath)}`,
      "set -- *",
      'if [ "$#" -eq 1 ] && [ "$1" = "*" ] && [ ! -e "$1" ] && [ ! -L "$1" ]; then set --; fi',
      'for entry in .[!.]* ..?*; do [ -e "$entry" ] || [ -L "$entry" ] || continue; set -- "$@" "$entry"; done',
      `if [ "$#" -eq 0 ]; then dd if=/dev/zero of=${shellQuote(remoteTar)} bs=1024 count=1; ` +
        `else tar -c --no-xattrs ${mapping.followSymlinks ? "-h " : ""}${excludeFlags} -f ${shellQuote(remoteTar)} -- "$@"; fi`,
    ].join(" && ");
    await assertSandboxCommandOk(sandbox, `sh -c ${shellQuote(tarScript)}`, timeoutSeconds, "syncOut tar");

    const localTar = path.join(tmp, "sync-out.tar");
    let bytesTransferred = 0;
    try {
      const responses = await sandbox.fs.downloadFiles(
        [{ source: remoteTar, destination: localTar }],
        timeoutSeconds,
      );
      const response = responses.find((entry) => entry.source === remoteTar) ?? responses[0];
      if (!response || response.error) {
        throw new Error(
          `Daytona syncOut directory download failed for ${mapping.sourcePath}: ${response?.error ?? "no response returned"}`,
        );
      }
      bytesTransferred = (await fs.stat(localTar)).size;
      await extractHostTarball({ archivePath: localTar, localDir: mapping.targetPath });
    } finally {
      // Best-effort remove the sandbox-side scratch tar; the host temp dir is
      // cleaned by withHostTempDir.
      await sandbox.fs
        .deleteFile(remoteTar)
        .catch(() => undefined);
    }
    const filesTransferred = await countHostFiles(mapping.targetPath, mapping.exclude);
    return { filesTransferred, bytesTransferred };
  });
}

export async function performSyncOut(input: {

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Check response.error in the message and verify the remoteTar path is writable/readable in the sandbox.
  2. Ensure no concurrent process deletes the scratch tar between creation and download.
  3. Retry the syncOut for transient Daytona/network failures.
  4. Verify the sandbox-side tarScript (run via assertSandboxCommandOk) actually produced the archive.
Defensive patterns

Strategy: retry

Try / catch

try {
  await syncOutDirectory(...);
} catch (e) {
  if (e instanceof Error && e.message.includes('directory download failed')) {
    // retry once; verify remoteTar scratch path is writable/readable
  }
  throw e;
}

Prevention

When it happens

Trigger: The syncOut directory path's remote tar (remoteTar) either returns no matching response or response.error is set from sandbox.fs.downloadFiles. The scratch tar deletion is best-effort in the finally block.

Common situations: The remote tar file was removed before download (sandbox cleanup race); Daytona API error; the tarScript sandbox command succeeded but produced an empty/missing archive; permission issues on the remote scratch dir; network interruption during download.

Related errors


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