Significant-Gravitas/AutoGPT · warning · Error
Chat export exceeded ${EXPORT_MAX_PAGES * EXPORT_PAGE_SIZE}
Error message
Chat export exceeded ${EXPORT_MAX_PAGES * EXPORT_PAGE_SIZE} messages. Please contact support to export this chat. What it means
A deliberate guard, not a failure: exportChatAsMarkdown paginates backwards through a session with EXPORT_PAGE_SIZE per page and a hard cap of EXPORT_MAX_PAGES. If the loop hits the last allowed page while has_more_messages is still true, `truncated` is set and this error is thrown instead of silently producing a partial export. The count EXPORT_MAX_PAGES * EXPORT_PAGE_SIZE is the maximum exportable message count.
Source
Thrown at autogpt_platform/frontend/src/app/(platform)/copilot/helpers/exportChatAsMarkdown.ts:119
throw new Error(`Failed to fetch session (status: ${response.status})`);
}
const pageMessages = (response.data.messages ??
[]) as unknown as SessionChatMessage[];
allMessages.unshift(...pageMessages);
const hasMore = !!response.data.has_more_messages;
const oldestSeq = response.data.oldest_sequence;
if (!hasMore || oldestSeq == null) break;
if (page === EXPORT_MAX_PAGES - 1) {
truncated = true;
break;
}
beforeSequence = oldestSeq;
}
if (truncated) {
throw new Error(
`Chat export exceeded ${EXPORT_MAX_PAGES * EXPORT_PAGE_SIZE} messages. Please contact support to export this chat.`,
);
}
exportChatAsMarkdown(id, title, allMessages);
}
View on GitHub (pinned to 9c8bb5550f)
Solutions
- Export is intentionally capped — contact support / use the backend API directly to page through the full history for very long chats.
- Raise EXPORT_MAX_PAGES in the constants if you self-host and accept larger exports.
- Split the conversation: start a new copilot session once chats get very long.
- If you believe the count is wrong, check whether the chat contains duplicate/bloated tool messages inflating the total.
Defensive patterns
Strategy: validation
Validate before calling
import { EXPORT_MAX_PAGES, EXPORT_PAGE_SIZE } from "./exportChatAsMarkdown";
function isExportable(messageCount: number): boolean {
return messageCount <= EXPORT_MAX_PAGES * EXPORT_PAGE_SIZE;
} Type guard
function isExportTruncation(err: unknown): boolean {
return err instanceof Error && err.message.startsWith("Chat export exceeded");
} Try / catch
try {
await exportSession(id);
} catch (error) {
if (isExportTruncation(error)) {
// informational, not a bug: direct user to support / backend export
toast({ title: "Chat too long to export", description: error.message });
}
} Prevention
- Surface the session's message count in the UI so users know before clicking export.
- Treat this throw as a by-design guard — don't catch-and-continue; a silent partial export is worse.
- For self-hosted very-long chats, provide a backend bulk-export path rather than raising the cap blindly.
When it happens
Trigger: Clicking Export on a copilot chat with more than EXPORT_MAX_PAGES * EXPORT_PAGE_SIZE messages; the loop consumed every page and the backend still reported has_more_messages=true with a valid oldest_sequence.
Common situations: Power users with months-long copilot sessions; agent loops that log hundreds of messages per run; someone lowered EXPORT_MAX_PAGES/EXPORT_PAGE_SIZE locally without realizing it caps exports.
Related errors
- Failed to fetch session (status: ${response.status})
- Authentication failed — please sign in again.
- Failed to download skill (HTTP ${res.status})
- Page must be greater than 0
- Page size must be greater than 0
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/29f9f095ca4cf220.
Report an issue: GitHub.