Sui.

Post

Share your knowledge.

Meaning.Sui.
Jul 27, 2025
Expert Q&A

how to fix BACKWARD_INCOMPATIBLE_MODULE_UPDATE error

Hi, I am trying to upgrade a contract published on testnet. I am just changing the version const value to 2. But while I try to upgrade it i am getting BACKWARD_INCOMPATIBLE_MODULE_UPDATE error.

Here is the error msg:

Error: Dry run failed, could not automatically determine a budget: PackageUpgradeError { upgrade_error: IncompatibleUpgrade } in command 1
    at setGasBudget (/Users/simusud/Desktop/new_one/one-sui-smart-contracts/node_modules/@mysten/sui/src/experimental/transports/json-rpc-resolver.ts:69:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[cause]: {
    effects: {
      messageVersion: 'v1',
      status: [Object],
      executedEpoch: '770',
      gasUsed: [Object],
      modifiedAtVersions: [Array],
      transactionDigest: 'DJBCDqPmJcUBamvV6eJfQxdZTXL3DT3bsKJ4jzDZ2vwd',
      mutated: [Array],
      gasObject: [Object],
      dependencies: [Array]
    },
    events: [],
    objectChanges: [ [Object], [Object] ],
    balanceChanges: [ [Object] ],
    input: {
      messageVersion: 'v1',
      transaction: [Object],
      sender: '0xa363fb07f43b034cd8f0bd6b75f15a2855da191191989fbb9b45d5e01ac87b2d',
      gasData: [Object]
    },
    executionErrorSource: 'PartialVMError with status BACKWARD_INCOMPATIBLE_MODULE_UPDATE'
  }
}
{ result: '' }
  • Sui
2
5
Share
Comments
.

Answers

5
harry phan.
Jul 27 2025, 12:06

The BACKWARD_INCOMPATIBLE_MODULE_UPDATE error in Sui typically occurs when your upgraded Move module introduces changes that are not backward-compatible with the previously published version.

Even minor-looking changes, like updating a constant value, can trigger this if the Sui framework determines that the module layout has changed in a way that might break compatibility for clients depending on the old version.

8
Comments
.
Benjamin XDV.
Jul 30 2025, 09:50

The BACKWARD_INCOMPATIBLE_MODULE_UPDATE error occurs when your Move module changes violate Sui's backward compatibility rules during an upgrade. To fix this, ensure all existing public function signatures, struct layouts, and storage formats remain unchanged when incrementing the version. Check for modifications to public/entry functions, struct fields, or key abilities that might break existing dependencies. Use sui move verify to detect compatibility issues before deploying. If intentional breaking changes are needed, consider deploying a new package instead of upgrading.

6
Comments
.
Evgeniy CRYPTOCOIN.
Jul 29 2025, 14:11

The BACKWARD_INCOMPATIBLE_MODULE_UPDATE error means your upgrade breaks backward compatibility. Even changing a const can trigger this if it alters the module's public API or storage layout.

How to Fix:

  1. Ensure Compatibility – Avoid:

    • Removing/renaming public functions or structs.
    • Changing existing struct fields (even private ones).
    • Modifying const values used in storage.
  2. Test with sui move verify – Checks upgrade compatibility before publishing.

  3. If Stuck:

    • Publish as a new package (not an upgrade).
    • Or keep the old version and deploy a new module.
2
Comments
.
Bekky.
Bekky1762
Jul 30 2025, 12:27

Root Cause

You're making breaking changes that violate Sui's backward compatibility rules. Even version number changes require strict adherence to upgrade rules.

Quick Fixes

  1. Ensure Structural Compatibility:

    • Never change existing public/entry function signatures
    • Never modify existing struct fields (order/type)
    • Only add new functions/structs
  2. For Version Bumps:

    // Old (v1)
    const VERSION: u64 = 1;
    
    // New (v2) - Add this instead of modifying
    const VERSION_2: u64 = 2;  // Keep old constant
    
  3. Required Steps:

    # 1. Verify compatibility
    sui move verify --path <your-package> --against <original-package-id>
    
    # 2. Upgrade with explicit compatibility check
    sui client upgrade --gas-budget 1000000000 --skip-compatibility-check false
    

Common Pitfalls

  • Changing public/entry function parameters
  • Reordering struct fields
  • Removing or modifying existing constants

If Absolutely Necessary

# Force upgrade (not recommended)
sui client upgrade --skip-compatibility-check true
1
Comments
.

Do you know the answer?

Please log in and share it.