paperclipai/paperclip · error · Error

Could not arm “Run tasks in this worktree” for Paperclip ins

Error message

Could not arm “Run tasks in this worktree” for Paperclip instance ${instanceId}. Check that PAPERCLIP_IN_WORKTREE=true and retry the command.

What it means

reconcileTestDriveWorktreeExecution arms the experimental 'Run tasks in this worktree' setting on the Paperclip instance and then re-reads /api/instance/settings/experimental to verify it actually took effect. This error means the verification read-back shows the setting is still not armed for the given instance.

Source

Thrown at cli/src/commands/test-drive.ts:312

  if (!current.enableWorktreeRunExecution) {
    await api.patch<InstanceExperimentalSettings>("/api/instance/settings/experimental", {
      enableWorktreeRunExecution: true,
    });
  } else if (!worktreeExecutionArmed(current, instanceId)) {
    await api.patch<InstanceExperimentalSettings>("/api/instance/settings/experimental", {
      enableWorktreeRunExecution: false,
    });
    await api.patch<InstanceExperimentalSettings>("/api/instance/settings/experimental", {
      enableWorktreeRunExecution: true,
    });
  }

  const verified = requiredApiResult(
    await api.get<InstanceExperimentalSettings>("/api/instance/settings/experimental"),
    "verifying experimental settings",
  );
  if (!worktreeExecutionArmed(verified, instanceId)) {
    throw new Error(
      `Could not arm “Run tasks in this worktree” for Paperclip instance ${instanceId}. ` +
        "Check that PAPERCLIP_IN_WORKTREE=true and retry the command.",
    );
  }
}

export async function bootstrapTestDrive(input: {
  api: TestDriveApi;
  options: TestDriveOptions;
  linkedWorktree: boolean;
  instanceId: string;
  env?: NodeJS.ProcessEnv;
}): Promise<TestDriveBootstrapResult> {
  const companies = requiredApiResult(
    await input.api.get<Company[]>("/api/companies"),
    "reading companies",
  );
  const existingCompany = companies[0];

View on GitHub (pinned to 01ad858492)

Solutions

  1. Restart the Paperclip server with PAPERCLIP_IN_WORKTREE=true and retry the command
  2. Verify the instance ID matches the running instance (`paperclip` status or instance listing)
  3. Re-run the command after confirming the server is healthy via /api/health

Example fix

// before
paperclip serve   # worktree execution unavailable
// after
PAPERCLIP_IN_WORKTREE=true paperclip serve
Defensive patterns

Strategy: retry

Validate before calling

const settings = await fetch('/api/instance/settings/experimental').then(r => r.json());
if (!settings.worktreeExecution?.enabled) {
  throw new Error('Start the server with PAPERCLIP_IN_WORKTREE=true first');
}

Try / catch

try {
  await bootstrapTestDrive(opts);
} catch (e) {
  if (String(e.message).includes('Run tasks in this worktree')) {
    console.error('Restart server with PAPERCLIP_IN_WORKTREE=true, then retry');
  } else throw e;
}

Prevention

When it happens

Trigger: The Paperclip server was not started with PAPERCLIP_IN_WORKTREE=true, so the worktree-execution capability cannot be armed; the instance ID does not match the instance the setting was applied to; or the settings API accepts but does not persist the flag.

Common situations: Running the test-drive CLI against a Paperclip instance launched normally (not inside a worktree); a stale instanceId from an old session; server restarted without the env var after a previous successful arm.

Related errors


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10). Data as JSON: /api/errors/ab1fcc6f49400eef. Report an issue: GitHub.