{"record":{"id":"e043c70e88acede9","repo":"paperclipai/paperclip","slug":"preparesandboxmanagedruntime-requires-a-client-tha","errorCode":null,"errorMessage":"prepareSandboxManagedRuntime requires a client that exposes syncIn (createCommandManagedRuntimeClient provides a native-or-fallback implementation).","messagePattern":"prepareSandboxManagedRuntime requires a client that exposes syncIn \\(createCommandManagedRuntimeClient provides a native-or-fallback implementation\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/adapter-utils/src/sandbox-managed-runtime.ts","lineNumber":748,"sourceCode":"    input.workspaceExclude,\n    gitIgnoredExcludes,\n  );\n  const baselineSnapshot = syncWorkspace\n    ? await captureDirectorySnapshot(input.workspaceLocalDir, { exclude: restoreExclude })\n    : null;\n\n  // Every inbound staging step delegates to the provider through `client.syncIn`:\n  // the orchestrator no longer inlines `writeFile`+`run` or chooses a transport,\n  // and there is no `usesCustomProvision` native-diversion gate. `syncIn` is\n  // ALWAYS present in production — the command-managed client exposes a native\n  // transport (Daytona/Kubernetes `uploadFiles` + provider-executed post-upload\n  // commands) or a byte-identical base64-tar fallback that reproduces the prior\n  // `writeFile`+`run` sequence. Require it explicitly so a misconfigured client\n  // fails loud rather than silently skipping staging. `syncOut` stays optional\n  // (native-only) with a tar fallback on the restore path below.\n  const syncIn = input.client.syncIn;\n  if (typeof syncIn !== \"function\") {\n    throw new Error(\n      \"prepareSandboxManagedRuntime requires a client that exposes syncIn \" +\n        \"(createCommandManagedRuntimeClient provides a native-or-fallback implementation).\",\n    );\n  }\n  const nativeSyncOut = typeof input.client.syncOut === \"function\";\n  let syncOperationSeq = 0;\n  // Opaque, ordered, non-sensitive operation tokens — never a caller/asset id.\n  const nextSyncOperationId = () => `sync-op-${++syncOperationSeq}`;\n\n  // Remote directory of each additional (referenced) project that stages\n  // successfully, keyed by projectId. A project that fails to stage is absent.\n  const additionalSourceDirs: Record<string, string> = {};\n  // Each additional (referenced) project whose staging failed, paired with the\n  // failure message. Per-project failure isolation keeps the run and the other\n  // projects going; this list makes each failure a first-class, reported outcome.\n  const additionalSourceFailures: AdditionalSourceStagingFailure[] = [];\n  // Additional projects stage as plain trees. Drop the heavy build/cache dirs a\n  // reference tree does not need, and `.git` — additional sources never carry","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/adapter-utils/src/sandbox-managed-runtime.ts#L730-L766","documentation":"Thrown in prepareSandboxManagedRuntime when input.client has no syncIn function. The orchestrator delegates all inbound staging (workspace, assets, additional sources) to client.syncIn — either a native provider transport (Daytona/Kubernetes uploadFiles) or a base64-tar fallback. Requiring syncIn explicitly makes a misconfigured client fail loud instead of silently skipping staging.","triggerScenarios":"Calling prepareSandboxManagedRuntime with a client object built without createCommandManagedRuntimeClient, or a custom client whose syncIn was deleted/undefined. The runtime then refuses to proceed because it cannot transfer files into the sandbox.","commonSituations":"Adapter was upgraded and the client factory changed; a test stub client omits syncIn; a partial client implementation that only implements run/exec was passed; dependency injection wired the wrong client interface.","solutions":["Construct the client via createCommandManagedRuntimeClient(input), which always provides a native-or-fallback syncIn.","If using a custom client, implement syncIn matching the SandboxManagedRuntimeClient.syncIn signature.","Add a type assertion / typeof check at client assembly time so misconfiguration is caught before prepare is called.","Update tests that hand-build stub clients to include a no-op or real syncIn."],"exampleFix":"// before\nconst client = { run: stubRun, exec: stubExec };\nawait prepareSandboxManagedRuntime({ ...input, client });\n// after\nconst client = createCommandManagedRuntimeClient(input);\nawait prepareSandboxManagedRuntime({ ...input, client });","handlingStrategy":"type-guard","validationCode":"if (typeof input.client.syncIn !== 'function') {\n  throw new Error('client.syncIn is required; build via createCommandManagedRuntimeClient');\n}","typeGuard":"function hasSyncIn(client: unknown): client is { syncIn: (...args: unknown[]) => unknown } {\n  return typeof (client as { syncIn?: unknown })?.syncIn === 'function';\n}","tryCatchPattern":null,"preventionTips":["Always construct clients with createCommandManagedRuntimeClient.","Type the prepare input so a missing syncIn is a compile error.","In tests, build stub clients from the same factory or include a no-op syncIn."],"tags":["sandbox","runtime","client","configuration","sync"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}