paperclipai/paperclip · critical

Daytona file sync requires a workspace remote dir on the lea

Error message

Daytona file sync requires a workspace remote dir on the lease metadata.

What it means

Thrown by resolveSyncRemoteDir when the lease metadata does not carry a non-empty string remoteCwd. The workspace remote dir is the confinement root for native file sync, recorded on lease metadata at acquire/resume time; sync cannot run without a concrete root to confine every sandbox path against.

Source

Thrown at packages/plugins/sandbox-providers/daytona/src/plugin.ts:769

    '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',
    'if [ -f "$HOME/.zprofile" ]; then . "$HOME/.zprofile" >/dev/null 2>&1 || true; fi',
  ];
  if (input.cwd) {
    lines.push(`cd ${shellQuote(input.cwd)}`);
  }
  lines.push(finalLine);
  return lines.join(" && ");
}

// The workspace remote dir is the confinement root for native file sync. It is
// recorded on the lease metadata at acquire/resume time; require it so a sync can
// never run without a concrete root to confine every sandbox path against.
function resolveSyncRemoteDir(lease: { metadata?: Record<string, unknown> | null }): string {
  const remoteCwd = lease.metadata?.remoteCwd;
  if (typeof remoteCwd === "string" && remoteCwd.trim().length > 0) {
    return remoteCwd.trim();
  }
  throw new Error("Daytona file sync requires a workspace remote dir on the lease metadata.");
}

async function createSandbox(
  params: PluginEnvironmentAcquireLeaseParams | PluginEnvironmentProbeParams | PluginEnvironmentStartInteractiveSetupParams,
  config: DaytonaDriverConfig,
  options: { purpose?: string } = {},
): Promise<Sandbox> {
  const resourceRequestError = validateRuntimeResourceRequest(config);
  if (resourceRequestError) {
    throw new Error(resourceRequestError);
  }
  const client = createDaytonaClient(config);
  const createParams = buildCreateParams(config, buildSandboxLabels({
    companyId: params.companyId,
    environmentId: params.environmentId,
    runId: "runId" in params ? params.runId : undefined,
    setupSessionId: "sessionId" in params ? params.sessionId : undefined,
    purpose: options.purpose,

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Ensure the sandbox lease is acquired/resumed via the standard path that sets metadata.remoteCwd (resolveSandboxWorkingDirectory result).
  2. Re-acquire the lease so remoteCwd is populated.
  3. If migrating, backfill metadata.remoteCwd on existing leases before syncing.
  4. Avoid running sync against leases created by external/non-standard tooling.
Defensive patterns

Strategy: validation

Validate before calling

function leaseHasRemoteCwd(lease: { metadata?: Record<string, unknown> | null }): boolean {
  const v = lease.metadata?.remoteCwd;
  return typeof v === 'string' && v.trim().length > 0;
}

Prevention

When it happens

Trigger: A file sync (syncIn/syncOut) is attempted on a lease whose metadata.remoteCwd is missing, not a string, or empty/whitespace-only. resolveSyncRemoteDir is called to determine the confinement root.

Common situations: The lease was acquired by an older code path that did not record remoteCwd; the sandbox was created outside the standard acquire flow; metadata was stripped/overwritten; a lease resumed after a metadata migration gap.

Related errors


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