paperclipai/paperclip · error · Error

Unsupported export format: ${value}

Error message

Unsupported export format: ${value}

What it means

normalizeFeedbackTraceExportFormat only accepts "json" or "ndjson" (default). Any other value is rejected before serialization.

Source

Thrown at cli/src/commands/client/feedback.ts:237

export function buildFeedbackTraceQuery(opts: FeedbackTraceQueryOptions, includePayload = true): string {
  const params = new URLSearchParams();
  if (opts.targetType) params.set("targetType", opts.targetType);
  if (opts.vote) params.set("vote", opts.vote);
  if (opts.status) params.set("status", opts.status);
  if (opts.projectId) params.set("projectId", opts.projectId);
  if (opts.issueId) params.set("issueId", opts.issueId);
  if (opts.from) params.set("from", opts.from);
  if (opts.to) params.set("to", opts.to);
  if (opts.sharedOnly) params.set("sharedOnly", "true");
  if (includePayload) params.set("includePayload", "true");
  const query = params.toString();
  return query ? `?${query}` : "";
}

export function normalizeFeedbackTraceExportFormat(value: string | undefined): "json" | "ndjson" {
  if (!value || value === "ndjson") return "ndjson";
  if (value === "json") return "json";
  throw new Error(`Unsupported export format: ${value}`);
}

export function serializeFeedbackTraces(traces: FeedbackTrace[], format: string | undefined): string {
  if (normalizeFeedbackTraceExportFormat(format) === "json") {
    return JSON.stringify(traces, null, 2);
  }
  return traces.map((trace) => JSON.stringify(trace)).join("\n");
}

export async function fetchCompanyFeedbackTraces(
  ctx: ResolvedClientContext,
  companyId: string,
  opts: FeedbackFilterOptions,
): Promise<FeedbackTrace[]> {
  return (
    (await ctx.api.get<FeedbackTrace[]>(
      `${apiPath`/api/companies/${companyId}/feedback-traces`}${buildFeedbackTraceQuery(opts, true)}`,
    )) ?? []

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Use --format json for a pretty-printed JSON array.
  2. Use --format ndjson (or omit) for newline-delimited JSON, one trace per line.

Example fix

// before
paperclipai feedback trace export --format csv
// after
paperclipai feedback trace export --format ndjson
Defensive patterns

Strategy: validation

Validate before calling

const FORMATS = new Set(['json', 'ndjson']);
function normalizeFormat(value?: string) {
  if (!value || value === 'ndjson') return 'ndjson';
  if (value === 'json') return 'json';
  throw new Error(`Unsupported export format: ${value}`);
}

Type guard

const isExportFormat = (v: string): v is 'json' | 'ndjson' => v === 'json' || v === 'ndjson';

Prevention

When it happens

Trigger: Passing --format csv|yaml|xml to a feedback-trace export command.

Common situations: Expecting a spreadsheet-friendly format; copying flags from another tool; typo.

Related errors


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