paperclipai/paperclip · error · Error

Export request returned no data

Error message

Export request returned no data

What it means

Thrown after the POST to `/api/companies/{companyId}/export` returns a falsy value. Per cli/src/client/http.ts the post() resolves to null on HTTP 204 No Content, an empty response body, or a 404 with ignoreNotFound. The export endpoint is expected to return a CompanyPortabilityExportResult JSON object; a null result means the server produced no export payload.

Source

Thrown at cli/src/commands/client/company.ts:1615

        false,
      )
      .action(async (companyId: string, opts: CompanyExportOptions) => {
        try {
          const ctx = resolveCommandContext(opts);
          const include = parseInclude(opts.include);
          const exported = await ctx.api.post<CompanyPortabilityExportResult>(
            apiPath`/api/companies/${companyId}/export`,
            {
              include,
              skills: parseCsvValues(opts.skills),
              projects: parseCsvValues(opts.projects),
              issues: parseCsvValues(opts.issues),
              projectIssues: parseCsvValues(opts.projectIssues),
              expandReferencedSkills: Boolean(opts.expandReferencedSkills),
            },
          );
          if (!exported) {
            throw new Error("Export request returned no data");
          }
          await confirmOverwriteExportDirectory(opts.out!, { force: Boolean(opts.force) });
          await writeExportToFolder(opts.out!, exported);
          printOutput(
            {
              ok: true,
              out: path.resolve(opts.out!),
              rootPath: exported.rootPath,
              filesWritten: Object.keys(exported.files).length,
              paperclipExtensionPath: exported.paperclipExtensionPath,
              warningCount: exported.warnings.length,
            },
            { json: ctx.json },
          );
          if (!ctx.json && exported.warnings.length > 0) {
            for (const warning of exported.warnings) {
              console.log(`warning=${warning}`);
            }

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Confirm the server is running and `curl -i http://<api-base>/api/companies/<id>/export -X POST` returns 200 with a JSON body.
  2. Check the API base (`paperclipai context current`) points at a Paperclip version that supports the export endpoint.
  3. If behind a proxy, raise the body-size / buffer limits and retry.
  4. Inspect server logs for an exception in the export handler that causes it to return 204/empty.

Example fix

// before: caller trusts the post
const exported = await ctx.api.post<...>(path, body);
await writeExportToFolder(out, exported);
// after: guard before use
if (!exported || !exported.files) {
  throw new Error("Export endpoint returned no usable payload; check server version and connectivity.");
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: confirm the export endpoint is live and returns JSON before relying on it.
async function canExport(api: { post: (p: string, b?: unknown) => Promise<unknown> }, companyId: string): Promise<boolean> {
  try {
    const probe = await api.post(`/api/companies/${companyId}/export`, { include: [] });
    return probe != null && typeof probe === "object" && "files" in (probe as object);
  } catch {
    return false;
  }
}

Type guard

import type { CompanyPortabilityExportResult } from "@paperclipai/shared";

function isExportResult(v: unknown): v is CompanyPortabilityExportResult {
  return !!v
    && typeof v === "object"
    && typeof (v as CompanyPortabilityExportResult).rootPath === "string"
    && typeof (v as CompanyPortabilityExportResult).files === "object"
    && Array.isArray((v as CompanyPortabilityExportResult).warnings);
}

Try / catch

try {
  const exported = await ctx.api.post<CompanyPortabilityExportResult>(path, body);
  if (!isExportResult(exported)) {
    throw new Error("Export returned no payload; verify server version and connectivity.");
  }
  await writeExportToFolder(out, exported);
} catch (err) {
  // Distinguish connectivity (ApiConnectionError) from empty-response from auth.
  throw err;
}

Prevention

When it happens

Trigger: The export endpoint responds 204 (No Content); the endpoint exists but returns an empty body (server bug or partial implementation); a proxy/load-balancer strips the body; the company ID resolves but the route 404s silently under ignoreNotFound behavior elsewhere.

Common situations: Server version mismatch where the API base points at an older Paperclip instance that has not implemented the export route; a reverse proxy (nginx/cloudflare) buffering or truncating large export responses; transient server error masked as 204.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/0ee4a060424319f2. Report an issue: GitHub.