{"record":{"id":"a40d6b1c8c020d3e","repo":"paperclipai/paperclip","slug":"svg-could-not-be-sanitized","errorCode":null,"errorMessage":"SVG could not be sanitized","messagePattern":"SVG could not be sanitized","errorType":"http","errorClass":null,"httpStatus":422,"severity":"error","filePath":"server/src/routes/assets.ts","lineNumber":151,"sourceCode":"    }\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;\n    }\n\n    const parsedMeta = createAssetImageMetadataSchema.safeParse(req.body ?? {});\n    if (!parsedMeta.success) {\n      res.status(400).json({\n        error: `Invalid image metadata: ${ASSET_NAMESPACE_RULE}`,\n        details: parsedMeta.error.issues,\n      });\n      return;\n    }\n\n    const namespaceSuffix = parsedMeta.data.namespace ?? \"general\";\n    const contentType = (file.mimetype || \"\").toLowerCase();\n    if (contentType !== SVG_CONTENT_TYPE && !isAllowedContentType(contentType)) {\n      res.status(422).json({ error: `Unsupported file type: ${contentType || \"unknown\"}` });\n      return;\n    }\n    let fileBody = file.buffer;\n    if (contentType === SVG_CONTENT_TYPE) {\n      const sanitized = sanitizeSvgBuffer(file.buffer);\n      if (!sanitized || sanitized.length <= 0) {\n        res.status(422).json({ error: \"SVG could not be sanitized\" });\n        return;\n      }\n      fileBody = sanitized;\n    }\n    if (fileBody.length <= 0) {\n      res.status(422).json({ error: \"Image is empty\" });\n      return;\n    }\n","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/assets.ts#L133-L169","documentation":"Error \"SVG could not be sanitized\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at server/src/routes/assets.ts:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove unsafe content from the SVG or upload a different image format."],"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-14T05:17:10.506Z"}