{"record":{"id":"1598baa668f506d0","repo":"paperclipai/paperclip","slug":"applying-a-company-import-with-json-requires-y","errorCode":null,"errorMessage":"Applying a company import with --json requires --yes. Use --dry-run first to inspect the preview.","messagePattern":"Applying a company import with --json requires --yes\\. Use --dry-run first to inspect the preview\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":809,"sourceCode":"export function buildCompanyDashboardUrl(apiBase: string, issuePrefix: string): string {\n  const url = new URL(apiBase);\n  const normalizedPrefix = issuePrefix.trim().replace(/^\\/+|\\/+$/g, \"\");\n  url.pathname = `${url.pathname.replace(/\\/+$/, \"\")}/${normalizedPrefix}/dashboard`;\n  url.search = \"\";\n  url.hash = \"\";\n  return url.toString();\n}\n\nexport function resolveCompanyImportApplyConfirmationMode(input: {\n  yes?: boolean;\n  interactive: boolean;\n  json: boolean;\n}): \"skip\" | \"prompt\" {\n  if (input.yes) {\n    return \"skip\";\n  }\n  if (input.json) {\n    throw new Error(\n      \"Applying a company import with --json requires --yes. Use --dry-run first to inspect the preview.\",\n    );\n  }\n  if (!input.interactive) {\n    throw new Error(\n      \"Applying a company import from a non-interactive terminal requires --yes. Use --dry-run first to inspect the preview.\",\n    );\n  }\n  return \"prompt\";\n}\n\nexport function isHttpUrl(input: string): boolean {\n  return /^https?:\\/\\//i.test(input.trim());\n}\n\nexport function looksLikeRepoUrl(input: string): boolean {\n  try {\n    const url = new URL(input.trim());","sourceCodeStart":791,"sourceCodeEnd":827,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L791-L827","documentation":"Thrown by resolveCompanyImportApplyConfirmationMode when an import apply is requested with --json but without --yes. JSON output mode is non-interactive by design, so there is no way to surface a confirmation prompt; the library refuses to apply blindly and tells the caller to inspect --dry-run first.","triggerScenarios":"Running 'paperclipai company import ... --json' without --yes and without --dry-run. Calling the apply path from a CI script that pipes --json for parsing but omits --yes. Any programmatic caller passing json:true, yes:false, and a dryRun:false path.","commonSituations":"CI pipelines that want structured output but were copy-pasted from the interactive docs without --yes. Wrapper scripts that always set --json and only learned about --yes after the first failure.","solutions":["Add --yes to the command: 'paperclipai company import ... --json --yes'.","Run with --dry-run --json first to inspect the preview, then re-run the apply with --yes --json.","If you want an interactive prompt, drop --json so the prompt can be shown.","In code, ensure input.yes is true whenever input.json is true before calling resolveCompanyImportApplyConfirmationMode."],"exampleFix":"# before\npaperclipai company import pkg.zip --target existing-company --company-id cmp_abc --json\n# after\npaperclipai company import pkg.zip --target existing-company --company-id cmp_abc --json --yes","handlingStrategy":"validation","validationCode":"function validateApplyMode(input: { yes?: boolean; json: boolean }): void {\n  if (input.json && !input.yes) {\n    throw new Error(\"--json apply requires --yes. Run --dry-run --json first.\");\n  }\n}","typeGuard":"function applyModeIsSafe(input: { yes?: boolean; json: boolean }): boolean {\n  return !input.json || input.yes === true;\n}","tryCatchPattern":null,"preventionTips":["Always pair --json with --yes in scripts.","Run --dry-run --json first and assert on the preview shape before applying.","Document the --json/--yes contract in CI job templates."],"tags":["cli","validation","company-import","non-interactive","json-mode"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}