actualbudget/actual · error · Error

Error exporting budget: ${result.error}

Error message

Error exporting budget: ${result.error}

What it means

exportBudget sends 'export-budget' to serialize the currently loaded budget into a zip buffer. If the core returns an error field, this is thrown with the detail. It means the export of the active budget failed server-side (disk/serialization problem or no usable budget).

Source

Thrown at packages/api/methods.ts:91

          filename,
          type,
        });

  if (result.error) {
    throw new Error(`Error importing budget: ${result.error}`);
  }
  if (!result.id) {
    throw new Error('Error importing budget: no budget was loaded');
  }
  return { id: result.id };
}

/** Export the currently-loaded budget as a zip buffer. */
export async function exportBudget(): Promise<Uint8Array> {
  const result = await send('export-budget');

  if ('error' in result) {
    throw new Error(`Error exporting budget: ${result.error}`);
  }
  if (!result.data) {
    throw new Error('Error exporting budget: no data was returned');
  }
  return new Uint8Array(result.data);
}

function toArrayBuffer(data: ArrayBuffer | Uint8Array): ArrayBuffer {
  if (data instanceof Uint8Array) {
    // Copy into a fresh ArrayBuffer so that views into a larger (possibly
    // shared) buffer are not sent across the worker boundary as-is.
    const copy = new Uint8Array(data.byteLength);
    copy.set(data);
    return copy.buffer;
  }
  return data;
}

View on GitHub (pinned to d4334cb6e6)

Solutions

  1. Read the detail in the thrown message to identify the core-side cause.
  2. Ensure a valid budget is loaded before exporting (loadBudget / successful open).
  3. Retry the export after restarting the API/server process to clear a bad in-memory state.
  4. Check available disk space and memory on the machine running the export.

Example fix

// before
const data = await api.exportBudget();
// after
let data;
try {
  data = await api.exportBudget();
} catch (e) {
  console.error('Budget export failed:', e.message);
  await api.loadBudget(budgetId); // re-load a known-good budget
  data = await api.exportBudget();
}
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  const zip = await api.exportBudget();
} catch (e) {
  if (String(e.message).startsWith('Error exporting budget:')) {
    console.error('Export failed:', e.message);
    // re-load budget and retry once, else alert backup pipeline
  } else throw e;
}

Prevention

When it happens

Trigger: Calling api.exportBudget() when the underlying core export fails: active budget in a broken state, low disk/memory during zipping, or internal error while building the export archive.

Common situations: Scheduled backup jobs exporting budgets from a long-running API process; exporting right after a failed migration; server under memory pressure with very large budgets.

Related errors


AI-assisted analysis of actualbudget/actual@d4334cb6e6 (2026-08-29). Data as JSON: /api/errors/0f404297455cf2c0. Report an issue: GitHub.