{"record":{"id":"55f200d8a8a1e186","repo":"paperclipai/paperclip","slug":"import-preview-returned-no-data","errorCode":null,"errorMessage":"Import preview returned no data.","messagePattern":"Import preview returned no data\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1780,"sourceCode":"                      ),\n                    );\n                  },\n            });\n          }\n          const transferPreviewPath = transferId\n            ? `/api/companies${companyImportTransferPreviewPath(transferId)}`\n            : null;\n\n          let selectedFiles: string[] | undefined;\n          if (interactiveView && !opts.yes && !opts.include?.trim()) {\n            const initialPreview = transferPreviewPath\n              ? await ctx.api.post<CompanyPortabilityPreviewResult>(transferPreviewPath, transferMeta)\n              : await ctx.api.post<CompanyPortabilityPreviewResult>(previewApiPath, {\n                  source: sourcePayload,\n                  ...transferMeta,\n                });\n            if (!initialPreview) {\n              throw new Error(\"Import preview returned no data.\");\n            }\n            selectedFiles = await promptForImportSelection(initialPreview);\n          }\n\n          const previewPayload = {\n            source: sourcePayload,\n            ...transferMeta,\n            selectedFiles,\n          };\n          const preview = transferPreviewPath\n            ? await ctx.api.post<CompanyPortabilityPreviewResult>(transferPreviewPath, {\n                ...transferMeta,\n                selectedFiles,\n              })\n            : await ctx.api.post<CompanyPortabilityPreviewResult>(previewApiPath, previewPayload);\n          if (!preview) {\n            throw new Error(\"Import preview returned no data.\");\n          }","sourceCodeStart":1762,"sourceCodeEnd":1798,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L1762-L1798","documentation":"Thrown in the interactive selection path: when the terminal is interactive, --yes is not set, and no --include was given, the CLI calls the preview endpoint to let the user pick files. If that initial preview POST resolves to null (HTTP 204, empty body, or ignored 404 per http.ts), this fires. It is distinct from the main preview throw at 1797.","triggerScenarios":"Interactive terminal run where the preview endpoint (transferPreviewPath or previewApiPath) returns 204/empty; a server-side bug in the preview handler returning no body; the transferId preview sub-path silently 404ing.","commonSituations":"Server version that has not fully implemented the import-preview/transfer-preview route; network middleware stripping the response body; running against a staging server with an incomplete import feature.","solutions":["Verify the preview endpoint returns 200 + JSON: `curl -i -X POST <api-base>/api/companies/import/preview`.","Bypass interactive selection by passing `--include` or `--yes` so the initial selection preview is skipped.","Ensure the CLI and server versions are aligned (both implement the transfer-preview path)."],"exampleFix":"# before (interactive, no include -> hits initial preview)\npaperclipai company import ./src\n# after (skip the interactive initial preview)\npaperclipai company import ./src --include skills,projects --yes","handlingStrategy":"validation","validationCode":"// Avoid the interactive initial-preview path entirely when scripting.\nfunction shouldSkipInteractiveSelection(opts: { yes: boolean; include?: string; json: boolean }): boolean {\n  return opts.yes || !!opts.include?.trim() || !process.stdin.isTTY;\n}\n// If false, ensure the server's preview endpoint returns JSON before relying on it.","typeGuard":"import type { CompanyPortabilityPreviewResult } from \"@paperclipai/shared\";\n\nfunction isPreviewResult(v: unknown): v is CompanyPortabilityPreviewResult {\n  return !!v && typeof v === \"object\" && \"files\" in (v as object);\n}","tryCatchPattern":"try {\n  const initial = await ctx.api.post<CompanyPortabilityPreviewResult>(path, meta);\n  if (!isPreviewResult(initial)) throw new Error(\"Preview returned no payload\");\n  selectedFiles = await promptForImportSelection(initial);\n} catch (err) {\n  if (err instanceof ApiConnectionError) { /* retry / surface connectivity */ }\n  throw err;\n}","preventionTips":["In automation, pass --include and --yes to bypass interactive selection.","Confirm preview endpoint parity between CLI and server before scripting imports.","Smoke-test the preview route with curl after server upgrades."],"tags":["cli","import","preview","empty-response","interactive"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}