paperclipai/paperclip · error · Error

That file is too large. Choose a GitHub App private key…

Error message

That file is too large. Choose a GitHub App private key smaller than 64 KB.

What it means

readGitHubPrivateKeyFile enforces a maximum file size of GITHUB_PRIVATE_KEY_FILE_MAX_BYTES (64 KB, matching GitHub's actual key size). GitHub App private keys are small PEM files (~1-2 KB); anything larger is almost certainly the wrong file, so the reader throws rather than reading it.

Solutions

  1. Select the actual .pem file downloaded from GitHub App settings (should be ~2 KB, starts with '-----BEGIN RSA PRIVATE KEY-----').
  2. Open the file in a text editor to confirm it is a PEM key, not a zip/binary; re-generate the key if needed.
  3. Check the file size in the input handler and warn before invoking the reader.
  4. Paste the key text directly into the provided textarea instead of file upload.

Example fix

// before
await readGitHubPrivateKeyFile(file);

// after
if (file.size > 64 * 1024) {
  setError("Choose a GitHub App private key (.pem) smaller than 64 KB.");
  return;
}
await readGitHubPrivateKeyFile(file);
Defensive patterns

Strategy: validation

Validate before calling

if (file.size > 64 * 1024) { showError("That file is too large. Choose a GitHub App private key smaller than 64 KB."); return; }

Type guard

const isPlausibleKeySize = (f: Pick<File, "size">): boolean => f.size > 0 && f.size <= 64 * 1024;

Try / catch

try {
  const key = await readGitHubPrivateKeyFile(file);
} catch (err) {
  if (err instanceof Error && err.message.includes("too large")) {
    showError("Please select the .pem private key, not a bundle or zip.");
  } else { throw err; }
}

Prevention

When it happens

Trigger: User selects a file larger than 64 KB in the GitHub private key picker — e.g. a bundle, a certificate chain, a screenshot-named .pem, or a combined key archive; passing an oversized Blob/File programmatically via the `privateKey` caller.

Common situations: User confuses the .pem private key with a larger downloaded credentials zip or an SSH key with a long comment; user selects their app's public cert or an old exported bundle; dragging the wrong file from the Downloads folder.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/dde2da8d40750c3f. Report an issue: GitHub.

Appendix: source

Thrown at ui/src/pages/apps/chat/github-private-key-file.ts:28

    invalidate() {
      revision += 1;
    },
    isCurrent(candidate: number) {
      return candidate === revision;
    },
  };
}

export async function readGitHubPrivateKeyFile(
  file: Pick<File, "size" | "text">,
): Promise<string> {
  if (file.size === 0) {
    throw new Error(
      "That file is empty. Choose the private key downloaded from your GitHub App.",
    );
  }
  if (file.size > GITHUB_PRIVATE_KEY_FILE_MAX_BYTES) {
    throw new Error(
      "That file is too large. Choose a GitHub App private key smaller than 64 KB.",
    );
  }

  let value: string;
  try {
    value = await file.text();
  } catch {
    throw new Error(
      "Paperclip couldn't read that file. Choose the .pem file again or paste the private key.",
    );
  }
  if (!value.trim()) {
    throw new Error(
      "That file is empty. Choose the private key downloaded from your GitHub App.",
    );
  }
  return value;

View on GitHub (pinned to 3f1d897a7c)