paperclipai/paperclip · error

Object not found.

Error message

Object not found.

What it means

Lookup-miss sentinel in the worktree storage read path: the requested object key had no readable body in the configured storage backend, used by callers (e.g. attachment lookup) to detect and skip objects that were never uploaded or have been removed.

Solutions

  1. Verify the object key exists; list objects for the worktree first.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cli/src/commands/worktree.ts:319 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18). Data as JSON: /api/errors/e45c759cf68dcc29. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/worktree.ts:352

  const parts = normalized.split("/").filter((part) => part.length > 0);
  if (parts.length === 0 || parts.some((part) => part === "." || part === "..")) {
    throw new Error("Invalid object key.");
  }
  return parts.join("/");
}

function resolveLocalStoragePath(baseDir: string, objectKey: string): string {
  const resolved = path.resolve(baseDir, normalizeStorageObjectKey(objectKey));
  const root = path.resolve(baseDir);
  if (resolved !== root && !resolved.startsWith(`${root}${path.sep}`)) {
    throw new Error("Invalid object key path.");
  }
  return resolved;
}

async function s3BodyToBuffer(body: unknown): Promise<Buffer> {
  if (!body) {
    throw new Error("Object not found.");
  }
  if (Buffer.isBuffer(body)) {
    return body;
  }
  if (body instanceof Readable) {
    return await streamToBuffer(body);
  }

  const candidate = body as {
    transformToWebStream?: () => ReadableStream<Uint8Array>;
    arrayBuffer?: () => Promise<ArrayBuffer>;
  };
  if (typeof candidate.transformToWebStream === "function") {
    const webStream = candidate.transformToWebStream();
    const reader = webStream.getReader();
    const chunks: Uint8Array[] = [];
    while (true) {
      const { done, value } = await reader.read();

View on GitHub (pinned to 01ad858492)