{"record":{"id":"ab1fcc6f49400eef","repo":"paperclipai/paperclip","slug":"could-not-arm-run-tasks-in-this-worktree-for-pap","errorCode":null,"errorMessage":"Could not arm “Run tasks in this worktree” for Paperclip instance ${instanceId}. Check that PAPERCLIP_IN_WORKTREE=true and retry the command.","messagePattern":"Could not arm “Run tasks in this worktree” for Paperclip instance (.+?)\\. Check that PAPERCLIP_IN_WORKTREE=true and retry the command\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/test-drive.ts","lineNumber":312,"sourceCode":"  if (!current.enableWorktreeRunExecution) {\n    await api.patch<InstanceExperimentalSettings>(\"/api/instance/settings/experimental\", {\n      enableWorktreeRunExecution: true,\n    });\n  } else if (!worktreeExecutionArmed(current, instanceId)) {\n    await api.patch<InstanceExperimentalSettings>(\"/api/instance/settings/experimental\", {\n      enableWorktreeRunExecution: false,\n    });\n    await api.patch<InstanceExperimentalSettings>(\"/api/instance/settings/experimental\", {\n      enableWorktreeRunExecution: true,\n    });\n  }\n\n  const verified = requiredApiResult(\n    await api.get<InstanceExperimentalSettings>(\"/api/instance/settings/experimental\"),\n    \"verifying experimental settings\",\n  );\n  if (!worktreeExecutionArmed(verified, instanceId)) {\n    throw new Error(\n      `Could not arm “Run tasks in this worktree” for Paperclip instance ${instanceId}. ` +\n        \"Check that PAPERCLIP_IN_WORKTREE=true and retry the command.\",\n    );\n  }\n}\n\nexport async function bootstrapTestDrive(input: {\n  api: TestDriveApi;\n  options: TestDriveOptions;\n  linkedWorktree: boolean;\n  instanceId: string;\n  env?: NodeJS.ProcessEnv;\n}): Promise<TestDriveBootstrapResult> {\n  const companies = requiredApiResult(\n    await input.api.get<Company[]>(\"/api/companies\"),\n    \"reading companies\",\n  );\n  const existingCompany = companies[0];","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/test-drive.ts#L294-L330","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restart the Paperclip server with PAPERCLIP_IN_WORKTREE=true and retry the command","Verify the instance ID matches the running instance (`paperclip` status or instance listing)","Re-run the command after confirming the server is healthy via /api/health"],"exampleFix":"// before\npaperclip serve   # worktree execution unavailable\n// after\nPAPERCLIP_IN_WORKTREE=true paperclip serve","handlingStrategy":"retry","validationCode":"const settings = await fetch('/api/instance/settings/experimental').then(r => r.json());\nif (!settings.worktreeExecution?.enabled) {\n  throw new Error('Start the server with PAPERCLIP_IN_WORKTREE=true first');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await bootstrapTestDrive(opts);\n} catch (e) {\n  if (String(e.message).includes('Run tasks in this worktree')) {\n    console.error('Restart server with PAPERCLIP_IN_WORKTREE=true, then retry');\n  } else throw e;\n}","preventionTips":["Always launch dev servers with PAPERCLIP_IN_WORKTREE=true when testing worktree flows","Confirm the setting stuck via GET /api/instance/settings/experimental after arming","Keep instance IDs current — refresh after server restarts"],"tags":["cli","config","worktree"],"backgroundTag":"feature-not-enabled","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}