paperclipai/paperclip · error · Error
Cannot capture a Daytona template without a setup sandbox le
Error message
Cannot capture a Daytona template without a setup sandbox lease.
What it means
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.
Source
Thrown at packages/plugins/sandbox-providers/daytona/src/plugin.ts:2242
providerLeaseId: sandbox.id,
status: "waiting_for_user",
...connection,
metadata: interactiveSetupMetadata({
config,
sandbox,
shellCommand,
remoteCwd,
}),
};
});
},
async onEnvironmentCaptureTemplate(
params: PluginEnvironmentCaptureTemplateParams,
): Promise<PluginEnvironmentCaptureTemplateResult> {
const config = parseDriverConfig(params.config);
if (!params.providerLeaseId) {
throw new Error("Cannot capture a Daytona template without a setup sandbox lease.");
}
const scope = {
driverKey: params.driverKey,
companyId: params.companyId,
environmentId: params.environmentId,
providerLeaseId: params.providerLeaseId,
config,
};
return await withSandboxActivityGate(scope, async () => {
const sandbox = await getSandbox(scope, { bypassTeardownGate: true });
const createSnapshot = (sandbox as DaytonaInteractiveSandbox)._experimental_createSnapshot;
if (typeof createSnapshot !== "function") {
throw new Error(
"Daytona template capture requires @daytonaio/sdk Sandbox._experimental_createSnapshot support.",
);
}
const templateRef = sanitizeSnapshotName(
params.templateLabel,View on GitHub (pinned to 67001ec6eb)
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.
Example fix
// before: capture without lease
await plugin.onEnvironmentCaptureTemplate({ ...params, providerLeaseId: undefined })
// after: pass the active setup lease id
await plugin.onEnvironmentCaptureTemplate({ ...params, providerLeaseId: setupSession.providerLeaseId }) Defensive patterns
Strategy: validation
Validate before calling
function hasSetupLeaseForCapture(params: { providerLeaseId?: string | null }): boolean {
return typeof params.providerLeaseId === 'string' && params.providerLeaseId.length > 0;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Daytona interactive setup can start from image or snapshot t
- Daytona SSH access did not return a token or SSH command.
- Daytona sandbox handle mismatch: handle ${sandbox.id} does n
- Daytona sync ${label} path is not a confined absolute path:
- Daytona sync ${label} path escapes the workspace remote dir:
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/1dcaacf4fc3ce41a.
Report an issue: GitHub.