Foundry376/Mailspring · error
Message '${messageId}' has no attachment with id '${fileId}'
Error message
Message '${messageId}' has no attachment with id '${fileId}' What it means
Resource handler guard in registerResources: the message was found and allowed, but no file in message.files has an id matching the fileId segment of the resource URI. The attachment reference is stale or mistyped; the attachment may have been removed from the message.
Source
Thrown at app/internal_packages/mcp-server/lib/mcp-tools.ts:359
toolName: 'resources/read',
params: uri.href.slice(0, 200),
resultSummary,
durationMs: Date.now() - start,
});
try {
// Variables come from the SDK's template match on the raw URI, so
// they preserve the ids' case (unlike uri.host, which URL lowercases).
const messageId = decodeURIComponent(String(variables.messageId));
const fileId = decodeURIComponent(String(variables.fileId));
const message = await DatabaseStore.find<Message>(Message, messageId);
if (!message || !isMessageAllowed(message)) {
throw new Error(`Message '${messageId}' not found`);
}
const file = (message.files || []).find((f) => f.id === fileId);
if (!file) {
throw new Error(`Message '${messageId}' has no attachment with id '${fileId}'`);
}
const filePath = await attachmentPathOnDisk(file);
if (!filePath) {
throw new Error(
`Attachment '${file.displayName()}' has not been downloaded — call the get_attachment tool first.`
);
}
const buffer = await fs.promises.readFile(filePath);
audit('ok');
return {
contents: [
{ uri: uri.href, mimeType: mimeTypeForFile(file), blob: buffer.toString('base64') },
],
};
} catch (err) {
audit(`error: ${(err as Error).message}`.slice(0, 100));
throw err;View on GitHub (pinned to 648c685d60)
Solutions
- Re-read the message's files list (e.g. via a messages tool) and use the current attachment id
- Ensure percent-encoding of the file id matches what the resource list emitted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/internal_packages/mcp-server/lib/mcp-tools.ts:359 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Foundry376/Mailspring@648c685d60 (2026-09-03).
Data as JSON: /api/errors/0243276df05b5331.
Report an issue: GitHub.