{"record":{"id":"1dcaacf4fc3ce41a","repo":"paperclipai/paperclip","slug":"cannot-capture-a-daytona-template-without-a-setup","errorCode":null,"errorMessage":"Cannot capture a Daytona template without a setup sandbox lease.","messagePattern":"Cannot capture a Daytona template without a setup sandbox lease\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/sandbox-providers/daytona/src/plugin.ts","lineNumber":2242,"sourceCode":"        providerLeaseId: sandbox.id,\n        status: \"waiting_for_user\",\n        ...connection,\n        metadata: interactiveSetupMetadata({\n          config,\n          sandbox,\n          shellCommand,\n          remoteCwd,\n        }),\n      };\n    });\n  },\n\n  async onEnvironmentCaptureTemplate(\n    params: PluginEnvironmentCaptureTemplateParams,\n  ): Promise<PluginEnvironmentCaptureTemplateResult> {\n    const config = parseDriverConfig(params.config);\n    if (!params.providerLeaseId) {\n      throw new Error(\"Cannot capture a Daytona template without a setup sandbox lease.\");\n    }\n    const scope = {\n      driverKey: params.driverKey,\n      companyId: params.companyId,\n      environmentId: params.environmentId,\n      providerLeaseId: params.providerLeaseId,\n      config,\n    };\n    return await withSandboxActivityGate(scope, async () => {\n      const sandbox = await getSandbox(scope, { bypassTeardownGate: true });\n    const createSnapshot = (sandbox as DaytonaInteractiveSandbox)._experimental_createSnapshot;\n    if (typeof createSnapshot !== \"function\") {\n      throw new Error(\n        \"Daytona template capture requires @daytonaio/sdk Sandbox._experimental_createSnapshot support.\",\n      );\n    }\n    const templateRef = sanitizeSnapshotName(\n      params.templateLabel,","sourceCodeStart":2224,"sourceCodeEnd":2260,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/sandbox-providers/daytona/src/plugin.ts#L2224-L2260","documentation":"Thrown by onEnvironmentCaptureTemplate when params.providerLeaseId is missing. Capturing a Daytona template (snapshot) requires an active setup sandbox lease to snapshot from; without it the capture cannot proceed.","triggerScenarios":"The capture-template flow is invoked with no providerLeaseId in params — e.g. the caller did not establish/retain the interactive setup lease before requesting a snapshot capture.","commonSituations":"The setup session expired/lease released before capture was requested; caller invokes capture without first completing startInteractiveSetup; lease id not propagated through the params; flow ordering bug where capture runs before acquire.","solutions":["Ensure the interactive setup sandbox lease is active (startInteractiveSetup completed) before calling captureTemplate.","Pass the providerLeaseId from the active setup session into the capture params.","If the lease expired, restart interactive setup and then capture.","Verify the capture flow ordering in the caller: acquire/setup → capture → release."],"exampleFix":"// before: capture without lease\nawait plugin.onEnvironmentCaptureTemplate({ ...params, providerLeaseId: undefined })\n// after: pass the active setup lease id\nawait plugin.onEnvironmentCaptureTemplate({ ...params, providerLeaseId: setupSession.providerLeaseId })","handlingStrategy":"validation","validationCode":"function hasSetupLeaseForCapture(params: { providerLeaseId?: string | null }): boolean {\n  return typeof params.providerLeaseId === 'string' && params.providerLeaseId.length > 0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Complete startInteractiveSetup and retain providerLeaseId before calling captureTemplate.","Re-establish the setup lease if it expired before capture.","Order the flow: acquire/setup → capture → release."],"tags":["daytona","interactive-setup","capture","snapshot","lease","validation"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}