{"record":{"id":"38d300ff565fc393","repo":"paperclipai/paperclip","slug":"daytona-file-sync-requires-a-workspace-remote-dir","errorCode":null,"errorMessage":"Daytona file sync requires a workspace remote dir on the lease metadata.","messagePattern":"Daytona file sync requires a workspace remote dir on the lease metadata\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/plugins/sandbox-providers/daytona/src/plugin.ts","lineNumber":769,"sourceCode":"    '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\n// The workspace remote dir is the confinement root for native file sync. It is\n// recorded on the lease metadata at acquire/resume time; require it so a sync can\n// never run without a concrete root to confine every sandbox path against.\nfunction resolveSyncRemoteDir(lease: { metadata?: Record<string, unknown> | null }): string {\n  const remoteCwd = lease.metadata?.remoteCwd;\n  if (typeof remoteCwd === \"string\" && remoteCwd.trim().length > 0) {\n    return remoteCwd.trim();\n  }\n  throw new Error(\"Daytona file sync requires a workspace remote dir on the lease metadata.\");\n}\n\nasync function createSandbox(\n  params: PluginEnvironmentAcquireLeaseParams | PluginEnvironmentProbeParams | PluginEnvironmentStartInteractiveSetupParams,\n  config: DaytonaDriverConfig,\n  options: { purpose?: string } = {},\n): Promise<Sandbox> {\n  const resourceRequestError = validateRuntimeResourceRequest(config);\n  if (resourceRequestError) {\n    throw new Error(resourceRequestError);\n  }\n  const client = createDaytonaClient(config);\n  const createParams = buildCreateParams(config, buildSandboxLabels({\n    companyId: params.companyId,\n    environmentId: params.environmentId,\n    runId: \"runId\" in params ? params.runId : undefined,\n    setupSessionId: \"sessionId\" in params ? params.sessionId : undefined,\n    purpose: options.purpose,","sourceCodeStart":751,"sourceCodeEnd":787,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/sandbox-providers/daytona/src/plugin.ts#L751-L787","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the sandbox lease is acquired/resumed via the standard path that sets metadata.remoteCwd (resolveSandboxWorkingDirectory result).","Re-acquire the lease so remoteCwd is populated.","If migrating, backfill metadata.remoteCwd on existing leases before syncing.","Avoid running sync against leases created by external/non-standard tooling."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function leaseHasRemoteCwd(lease: { metadata?: Record<string, unknown> | null }): boolean {\n  const v = lease.metadata?.remoteCwd;\n  return typeof v === 'string' && v.trim().length > 0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always acquire/resume leases through the standard path that records metadata.remoteCwd.","Re-acquire leases missing remoteCwd rather than syncing against them.","Backfill remoteCwd on migrated/legacy leases before enabling sync."],"tags":["daytona","file-sync","lease","metadata","config"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}