paperclipai/paperclip · error

File exceeds ${MAX_ATTACHMENT_BYTES} bytes

Error message

File exceeds ${MAX_ATTACHMENT_BYTES} bytes

What it means

Error "File exceeds ${MAX_ATTACHMENT_BYTES} bytes" thrown in paperclipai/paperclip.

Source

Thrown at server/src/routes/assets.ts:120

  async function runSingleFileUpload(
    upload: ReturnType<typeof multer>,
    req: Request,
    res: Response,
  ) {
    await new Promise<void>((resolve, reject) => {
      upload.single("file")(req, res, (err: unknown) => {
        if (err) reject(err);
        else resolve();
      });
    });
  }

  router.post("/companies/:companyId/assets/images", async (req, res) => {
    const companyId = req.params.companyId as string;
    assertCompanyAccess(req, companyId);

    try {
      await runSingleFileUpload(assetUpload, req, res);
    } catch (err) {
      if (err instanceof multer.MulterError) {
        if (err.code === "LIMIT_FILE_SIZE") {
          res.status(422).json({
            error: `File is larger than the ${formatAttachmentSize(MAX_ATTACHMENT_BYTES)} limit`,
          });
          return;
        }
        res.status(400).json({ error: err.message });
        return;
      }
      throw err;
    }

    const file = (req as Request & { file?: { mimetype: string; buffer: Buffer; originalname: string } }).file;
    if (!file) {
      res.status(400).json({ error: "Missing file field 'file'" });
      return;

View on GitHub (pinned to 01ad858492)

Solutions

  1. Reduce the file size below the maximum attachment byte limit, then upload again.

When it happens

Trigger: Thrown at server/src/routes/assets.ts:119 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/5a47d42a79ace987. Report an issue: GitHub.