Fixing "OUTDATED_SCHEMA" Error When Creating New Ledgers

Last updated: March 20, 2025

When creating a new ledger, you may encounter the following error:

{
    "errorCode": "OUTDATED_SCHEMA",
    "errorMessage": "bucket is outdated, you need to upgrade it before adding a new ledger"
}

Resolution

This error occurs when your database schema needs to be upgraded to match your current Ledger version. To resolve this:

Option 1: Manual Migration

  1. Back up your database before proceeding

  2. Run the command: ledger migrate

Option 2: Automatic Migration (Version 2.2+)

For version 2.2 and above, you can enable automatic schema upgrades by either:

  • Setting the flag: --auto-upgrade

  • Or setting the environment variable: AUTO_UPGRADE

The auto-upgrade option is particularly useful in development environments but should be used with caution in production.