Foundry376/Mailspring · error
Attachment '${file.displayName()}' has not been downloaded —
Error message
Attachment '${file.displayName()}' has not been downloaded — call the get_attachment tool first. What it means
Resource handler guard in registerResources: the attachment exists but has no downloaded content in the local files directory. The MCP protocol requires content to be fetched explicitly first, so this directs the client to run the get_attachment tool before reading the resource stream.
Source
Thrown at app/internal_packages/mcp-server/lib/mcp-tools.ts:363
});
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
- Call the get_attachment tool for this file, then re-request the resource
- Treat the error as an actionable workflow step rather than a failure: expose it in the tool description so clients sequence downloads correctly
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at app/internal_packages/mcp-server/lib/mcp-tools.ts:363 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/3e51b19946f5da5a.
Report an issue: GitHub.