paperclipai/paperclip · error
attachment ${attachment.id} is ${attachment.byteSize} bytes,
Error message
attachment ${attachment.id} is ${attachment.byteSize} bytes, over the ${maxBytes}-byte cap What it means
getAttachmentContent was called with a maxBytes cap smaller than the attachment's stored byteSize. The host refuses to read the object so plugins cannot trick it into buffering oversized attachments.
Source
Thrown at server/src/services/plugin-host-services.ts:2597
return { interaction: resolved as any, applied: true };
},
async listAttachments(params) {
const companyId = ensureCompanyId(params.companyId);
await ensurePluginAvailableForCompany(companyId);
if (!inCompany(await issues.getById(params.issueId), companyId)) return [];
return (await issues.listAttachments(params.issueId)) as any;
},
async getAttachmentContent(params) {
const companyId = ensureCompanyId(params.companyId);
await ensurePluginAvailableForCompany(companyId);
const attachment = await issues.getAttachmentById(params.attachmentId);
// Unknown and cross-company ids are deliberately indistinguishable to
// the plugin: both return null (no existence oracle across companies).
if (!attachment || attachment.companyId !== companyId) return null;
const maxBytes = typeof params.maxBytes === "number" && params.maxBytes > 0 ? params.maxBytes : null;
if (maxBytes !== null && attachment.byteSize > maxBytes) {
throw new Error(
`attachment ${attachment.id} is ${attachment.byteSize} bytes, over the ${maxBytes}-byte cap`,
);
}
const object = await getStorageService().getObject(attachment.companyId, attachment.objectKey);
const chunks: Buffer[] = [];
let total = 0;
for await (const chunk of object.stream) {
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
total += buf.length;
// Defense in depth: enforce the cap during streaming too, so a
// metadata/object size mismatch can never exceed the requested cap.
if (maxBytes !== null && total > maxBytes) {
object.stream.destroy();
throw new Error(`attachment ${attachment.id} exceeded the ${maxBytes}-byte cap while reading`);
}
chunks.push(buf);
}View on GitHub (pinned to a7e689b3c3)
Solutions
- Reduce the attachment size below the byte cap shown in the error, or split the payload into multiple smaller attachments.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/plugin-host-services.ts:2588 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18).
Data as JSON: /api/errors/e93e96ac95eb24a8.
Report an issue: GitHub.