paperclipai/paperclip · error
SVG could not be sanitized
Error message
SVG could not be sanitized
What it means
Error "SVG could not be sanitized" thrown in paperclipai/paperclip.
Source
Thrown at server/src/routes/assets.ts:151
}
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;
}
const parsedMeta = createAssetImageMetadataSchema.safeParse(req.body ?? {});
if (!parsedMeta.success) {
res.status(400).json({
error: `Invalid image metadata: ${ASSET_NAMESPACE_RULE}`,
details: parsedMeta.error.issues,
});
return;
}
const namespaceSuffix = parsedMeta.data.namespace ?? "general";
const contentType = (file.mimetype || "").toLowerCase();
if (contentType !== SVG_CONTENT_TYPE && !isAllowedContentType(contentType)) {
res.status(422).json({ error: `Unsupported file type: ${contentType || "unknown"}` });
return;
}
let fileBody = file.buffer;
if (contentType === SVG_CONTENT_TYPE) {
const sanitized = sanitizeSvgBuffer(file.buffer);
if (!sanitized || sanitized.length <= 0) {
res.status(422).json({ error: "SVG could not be sanitized" });
return;
}
fileBody = sanitized;
}
if (fileBody.length <= 0) {
res.status(422).json({ error: "Image is empty" });
return;
}
View on GitHub (pinned to 01ad858492)
Solutions
- Remove unsafe content from the SVG or upload a different image format.
When it happens
Trigger: Thrown at server/src/routes/assets.ts:150 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/a40d6b1c8c020d3e.
Report an issue: GitHub.