{"record":{"id":"5a47d42a79ace987","repo":"paperclipai/paperclip","slug":"file-exceeds-max-attachment-bytes-bytes","errorCode":null,"errorMessage":"File exceeds ${MAX_ATTACHMENT_BYTES} bytes","messagePattern":"File exceeds (.+?) bytes","errorType":"http","errorClass":null,"httpStatus":422,"severity":"error","filePath":"server/src/routes/assets.ts","lineNumber":120,"sourceCode":"  async function runSingleFileUpload(\n    upload: ReturnType<typeof multer>,\n    req: Request,\n    res: Response,\n  ) {\n    await new Promise<void>((resolve, reject) => {\n      upload.single(\"file\")(req, res, (err: unknown) => {\n        if (err) reject(err);\n        else resolve();\n      });\n    });\n  }\n\n  router.post(\"/companies/:companyId/assets/images\", async (req, res) => {\n    const companyId = req.params.companyId as string;\n    assertCompanyAccess(req, companyId);\n\n    try {\n      await runSingleFileUpload(assetUpload, req, res);\n    } catch (err) {\n      if (err instanceof multer.MulterError) {\n        if (err.code === \"LIMIT_FILE_SIZE\") {\n          res.status(422).json({\n            error: `File is larger than the ${formatAttachmentSize(MAX_ATTACHMENT_BYTES)} limit`,\n          });\n          return;\n        }\n        res.status(400).json({ error: err.message });\n        return;\n      }\n      throw err;\n    }\n\n    const file = (req as Request & { file?: { mimetype: string; buffer: Buffer; originalname: string } }).file;\n    if (!file) {\n      res.status(400).json({ error: \"Missing file field 'file'\" });\n      return;","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/assets.ts#L102-L138","documentation":"Error \"File exceeds ${MAX_ATTACHMENT_BYTES} bytes\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at server/src/routes/assets.ts:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the file size below the maximum attachment byte limit, then upload again."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}