paperclipai/paperclip · error · Error
Import preview returned no data.
Error message
Import preview returned no data.
What it means
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.
Source
Thrown at cli/src/commands/client/company.ts:1780
),
);
},
});
}
const transferPreviewPath = transferId
? `/api/companies${companyImportTransferPreviewPath(transferId)}`
: null;
let selectedFiles: string[] | undefined;
if (interactiveView && !opts.yes && !opts.include?.trim()) {
const initialPreview = transferPreviewPath
? await ctx.api.post<CompanyPortabilityPreviewResult>(transferPreviewPath, transferMeta)
: await ctx.api.post<CompanyPortabilityPreviewResult>(previewApiPath, {
source: sourcePayload,
...transferMeta,
});
if (!initialPreview) {
throw new Error("Import preview returned no data.");
}
selectedFiles = await promptForImportSelection(initialPreview);
}
const previewPayload = {
source: sourcePayload,
...transferMeta,
selectedFiles,
};
const preview = transferPreviewPath
? await ctx.api.post<CompanyPortabilityPreviewResult>(transferPreviewPath, {
...transferMeta,
selectedFiles,
})
: await ctx.api.post<CompanyPortabilityPreviewResult>(previewApiPath, previewPayload);
if (!preview) {
throw new Error("Import preview returned no data.");
}View on GitHub (pinned to 67001ec6eb)
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).
Example fix
# before (interactive, no include -> hits initial preview) paperclipai company import ./src # after (skip the interactive initial preview) paperclipai company import ./src --include skills,projects --yes
Defensive patterns
Strategy: validation
Validate before calling
// Avoid the interactive initial-preview path entirely when scripting.
function shouldSkipInteractiveSelection(opts: { yes: boolean; include?: string; json: boolean }): boolean {
return opts.yes || !!opts.include?.trim() || !process.stdin.isTTY;
}
// If false, ensure the server's preview endpoint returns JSON before relying on it. Type guard
import type { CompanyPortabilityPreviewResult } from "@paperclipai/shared";
function isPreviewResult(v: unknown): v is CompanyPortabilityPreviewResult {
return !!v && typeof v === "object" && "files" in (v as object);
} Try / catch
try {
const initial = await ctx.api.post<CompanyPortabilityPreviewResult>(path, meta);
if (!isPreviewResult(initial)) throw new Error("Preview returned no payload");
selectedFiles = await promptForImportSelection(initial);
} catch (err) {
if (err instanceof ApiConnectionError) { /* retry / surface connectivity */ }
throw err;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Import request returned no data.
- Export cancelled.
- Export request returned no data
- Source path or URL is required.
- Invalid --collision value. Use: rename, skip, replace
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/55f200d8a8a1e186.
Report an issue: GitHub.