{"record":{"id":"0ee4a060424319f2","repo":"paperclipai/paperclip","slug":"export-request-returned-no-data","errorCode":null,"errorMessage":"Export request returned no data","messagePattern":"Export request returned no data","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1615,"sourceCode":"        false,\n      )\n      .action(async (companyId: string, opts: CompanyExportOptions) => {\n        try {\n          const ctx = resolveCommandContext(opts);\n          const include = parseInclude(opts.include);\n          const exported = await ctx.api.post<CompanyPortabilityExportResult>(\n            apiPath`/api/companies/${companyId}/export`,\n            {\n              include,\n              skills: parseCsvValues(opts.skills),\n              projects: parseCsvValues(opts.projects),\n              issues: parseCsvValues(opts.issues),\n              projectIssues: parseCsvValues(opts.projectIssues),\n              expandReferencedSkills: Boolean(opts.expandReferencedSkills),\n            },\n          );\n          if (!exported) {\n            throw new Error(\"Export request returned no data\");\n          }\n          await confirmOverwriteExportDirectory(opts.out!, { force: Boolean(opts.force) });\n          await writeExportToFolder(opts.out!, exported);\n          printOutput(\n            {\n              ok: true,\n              out: path.resolve(opts.out!),\n              rootPath: exported.rootPath,\n              filesWritten: Object.keys(exported.files).length,\n              paperclipExtensionPath: exported.paperclipExtensionPath,\n              warningCount: exported.warnings.length,\n            },\n            { json: ctx.json },\n          );\n          if (!ctx.json && exported.warnings.length > 0) {\n            for (const warning of exported.warnings) {\n              console.log(`warning=${warning}`);\n            }","sourceCodeStart":1597,"sourceCodeEnd":1633,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L1597-L1633","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the server is running and `curl -i http://<api-base>/api/companies/<id>/export -X POST` returns 200 with a JSON body.","Check the API base (`paperclipai context current`) points at a Paperclip version that supports the export endpoint.","If behind a proxy, raise the body-size / buffer limits and retry.","Inspect server logs for an exception in the export handler that causes it to return 204/empty."],"exampleFix":"// before: caller trusts the post\nconst exported = await ctx.api.post<...>(path, body);\nawait writeExportToFolder(out, exported);\n// after: guard before use\nif (!exported || !exported.files) {\n  throw new Error(\"Export endpoint returned no usable payload; check server version and connectivity.\");\n}","handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm the export endpoint is live and returns JSON before relying on it.\nasync function canExport(api: { post: (p: string, b?: unknown) => Promise<unknown> }, companyId: string): Promise<boolean> {\n  try {\n    const probe = await api.post(`/api/companies/${companyId}/export`, { include: [] });\n    return probe != null && typeof probe === \"object\" && \"files\" in (probe as object);\n  } catch {\n    return false;\n  }\n}","typeGuard":"import type { CompanyPortabilityExportResult } from \"@paperclipai/shared\";\n\nfunction isExportResult(v: unknown): v is CompanyPortabilityExportResult {\n  return !!v\n    && typeof v === \"object\"\n    && typeof (v as CompanyPortabilityExportResult).rootPath === \"string\"\n    && typeof (v as CompanyPortabilityExportResult).files === \"object\"\n    && Array.isArray((v as CompanyPortabilityExportResult).warnings);\n}","tryCatchPattern":"try {\n  const exported = await ctx.api.post<CompanyPortabilityExportResult>(path, body);\n  if (!isExportResult(exported)) {\n    throw new Error(\"Export returned no payload; verify server version and connectivity.\");\n  }\n  await writeExportToFolder(out, exported);\n} catch (err) {\n  // Distinguish connectivity (ApiConnectionError) from empty-response from auth.\n  throw err;\n}","preventionTips":["Pin CLI and server to compatible versions; export is a newer contract.","Smoke-test the export endpoint with curl -i after upgrades.","When proxying, set generous body-size limits for export responses."],"tags":["cli","export","network","empty-response","company-portability"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}