paperclipai/paperclip · error · Error

Ingest operation did not return an issue id; the dropped fil

Error message

Ingest operation did not return an issue id; the dropped file could not be attached.

What it means

Thrown by readIngestOperationIssueId() when the result of an ingest source action does not contain a usable operation.issue.id string. The LLM Wiki issue-attachment UI uses this to attach a dropped file to the issue created by an ingest operation; without a valid issue id the attachment has no target. The function accepts unknown and narrows result.operation.issue.id, requiring a non-empty trimmed string.

Source

Thrown at packages/plugins/plugin-llm-wiki/src/ui/issue-attachments.ts:14

type FetchLike = (input: string, init: RequestInit) => Promise<Response>;

export type IngestSourceActionResult = {
  operation?: {
    issue?: {
      id?: unknown;
    } | null;
  } | null;
};

export function readIngestOperationIssueId(result: unknown): string {
  const issueId = (result as IngestSourceActionResult | null)?.operation?.issue?.id;
  if (typeof issueId === "string" && issueId.trim()) return issueId;
  throw new Error("Ingest operation did not return an issue id; the dropped file could not be attached.");
}

async function readUploadError(response: Response): Promise<string> {
  const body = await response.json().catch(() => null);
  if (body && typeof body === "object") {
    const error = (body as { error?: unknown; message?: unknown }).error;
    if (typeof error === "string" && error.trim()) return error;
    const message = (body as { error?: unknown; message?: unknown }).message;
    if (typeof message === "string" && message.trim()) return message;
  }
  return `Attachment upload failed with HTTP ${response.status}.`;
}

export async function uploadIssueAttachmentFile(input: {
  companyId: string;
  issueId: string;
  file: File;
  fetchImpl?: FetchLike;

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Verify the ingest operation actually created an issue before calling readIngestOperationIssueId() (await the operation to completion).
  2. Check the backend API contract for the ingest source action; ensure it returns operation.issue.id as a non-empty string.
  3. If the ingest legitimately produces no issue, do not call this reader — branch on result shape first.

Example fix

// before
const id = readIngestOperationIssueId(ingestResult); // throws if id missing
// after
const raw = (ingestResult as any)?.operation?.issue?.id;
if (typeof raw === "string" && raw.trim()) {
  const id = raw.trim();
  await uploadIssueAttachmentFile({ companyId, issueId: id, file });
} else {
  // handle: ingest did not produce an issue yet
}
Defensive patterns

Strategy: type-guard

Validate before calling

function tryReadIssueId(result: unknown): string | null {
  const id = (result as any)?.operation?.issue?.id;
  return typeof id === "string" && id.trim() ? id.trim() : null;
}
const id = tryReadIssueId(ingestResult);
if (!id) { /* handle: no issue yet */ }

Type guard

function hasIngestIssueId(r: unknown): r is { operation: { issue: { id: string } } } {
  const id = (r as any)?.operation?.issue?.id;
  return typeof id === "string" && id.trim().length > 0;
}

Try / catch

try {
  const id = readIngestOperationIssueId(result);
} catch (err) {
  if (err instanceof Error && err.message.includes("did not return an issue id")) {
    // wait/retry ingest, or surface 'no issue created' to user
  } else throw err;
}

Prevention

When it happens

Trigger: Calling readIngestOperationIssueId() on a result where the ingest operation has not yet created an issue (async not complete). The backend returned a result shape missing operation.issue.id (API contract drift). The ingest action errored but returned a 2xx with no issue ref.

Common situations: Backend version mismatch where the ingest result schema changed. Race: caller reads the result before the issue row is committed. A custom ingest source plugin that does not populate operation.issue.id.

Related errors


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