different-ai/openwork · error
app.error_compact_empty
Error message
app.error_compact_empty
What it means
createSessionActionsStore's compact action refuses to run session compaction when the current visible message list is empty. Compaction summarizes conversation history, so there is nothing to summarize with zero visible messages. The localized message 'app.error_compact_empty' is thrown before any performance logging or server call is made.
Source
Thrown at apps/app/src/react-app/domains/session/sync/actions-store.ts:652
parts: [{ type: "text", text }],
attachments: [],
});
}
async function compactCurrentSession(sessionIdOverride?: string) {
const c = options.client();
if (!c) {
throw new Error(t("app.error_not_connected"));
}
const sessionID = (sessionIdOverride ?? options.selectedSessionId() ?? "").trim();
if (!sessionID) {
throw new Error(t("app.error_compact_no_session_id"));
}
const visible = options.messages();
if (!visible.length) {
throw new Error(t("app.error_compact_empty"));
}
const model = options.selectedSessionModel();
const startedAt = perfNow();
const modelLabel = `${model.providerID}/${model.modelID}`;
recordPerfLog(options.developerMode(), "session.compact", "start", {
sessionID,
messageCount: visible.length,
model: modelLabel,
variant: options.sanitizeModelVariantForRef(model, options.modelVariant()) ?? null,
});
try {
await compactSessionTyped(c, sessionID, model, {
directory: options.runtimeWorkspaceRoot().trim() || options.selectedWorkspaceRoot().trim() || undefined,
});
finishPerf(options.developerMode(), "session.compact", "done", startedAt, {
sessionID,View on GitHub (pinned to 2b7df46e8a)
Solutions
- Ensure at least one visible message exists before invoking compact; disable the compact UI affordance when messages().length === 0.
- Check the messages() selector — visibility filters may be hiding messages that actually exist; fix the filter or session id.
- Wrap the compact call in try/catch and surface the localized message to the user instead of crashing.
Example fix
// before: await actions.compactSession(sessionID) | // after: if (actions.messages().length > 0) { await actions.compactSession(sessionID) } Defensive patterns
Strategy: validation
Validate before calling
const visible = actions.messages(); if (visible.length === 0) { return; } await actions.compactSession(sessionID); Try / catch
try { await actions.compactSession(sessionID); } catch (e) { if (e.message.includes('compact')) { showToast(t('app.error_compact_empty')); } else { throw e; } } Prevention
- Disable the compact button when the visible message list is empty.
- Re-check message count after filters or session switches change visibility.
- Keep compact actions tied to sessions with confirmed non-empty history.
When it happens
Trigger: Calling the compact session action (via createSessionActionsStore) while options.messages() returns an empty array — e.g. compacting a brand-new session before the first message is sent, or after all messages were filtered out as invisible.
Common situations: A UI compact button enabled on a fresh/empty chat; messages cleared or pruned by a filter but compact invoked from a stale menu; automated scripts compacting a session id that resolved to no visible messages.
Related errors
- Cannot create a task without a selected workspace.
- app.error_not_connected
- app.error_compact_no_session_id
- invalid_session_payload
- Unknown error
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/c321a32b5612cd9b.
Report an issue: GitHub.