# How to check for enhanced orthogonal persistence? (bug?)

**URL:** <https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830>\
**Category:** Motoko\
**Created:** [March 21, 2025, 6:02pm UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830 "2025-03-21T18:02:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [March 21, 2025, 6:02pm UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/1 "2025-03-21T18:02:53Z")

</div>

How to check whether a canister was compiled with enhanced orthogonal persistence?

I see errors like:

```plaon
Invalid upgrade option: The `wasm_memory_persistence: opt Keep` upgrade option requires that the new canister module supports enhanced orthogonal persistence.

```

even despite I have in `dfx.json`:

```auto
  "defaults": {
    "build": {
      "args": "--enhanced-orthogonal-persistence",
      "packtool": "mops sources"
    }
  },

```

So, it seems EOP doesn’t work for me.

I do upgrades by `CyclesLedger.install_code`:

```motoko
            let newCanisterId = switch (canister_id) {
                case (?canister_id) {
                    let mode2 = if (wasmModule.forceReinstall) {
                        #reinstall
                    } else {
                        #upgrade (?{ wasm_memory_persistence = ?#keep; skip_pre_upgrade = ?false }); // TODO: Check modes carefully.
                    };
                    // TODO: consider invoking user's callback if needed.
                    let simple: SimpleIndirect.SimpleIndirect = actor(Principal.toText(simpleIndirect));
                    await simple.install_code({
                        sender_canister_version = null; // TODO: set appropriate value if needed.
                        arg = to_candid({
                            packageManagerOrBootstrapper;
                            mainIndirect;
                            simpleIndirect;
                            user;
                            installationId;
                            upgradeId;
                            userArg = ?upgradeArg;
                        });
                        wasm_module;
                        mode = mode2;
                        canister_id;
                    }, 1000_000_000_000); // TODO
                    canister_id;
                };
...

```

I use today versions of DFX and moc.

---

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [March 21, 2025, 6:03pm UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/2 "2025-03-21T18:03:59Z")

</div>

Also, it’s unclear, how to upgrade from 32 bit to EOP.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 24, 2025, 9:55am UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/3 "2025-03-24T09:55:04Z")

</div>

> [@qwertytrewq](#):
>
> ```auto
> "defaults": {
> "build": {
> "args": "--enhanced-orthogonal-persistence",
> "packtool": "mops sources"
> }
> },
> 
> ```

this needs to go in `canisters.<canister name>.args` for every canister. E.g. like this:

```auto
{
  "canisters": {
    "backend": {
      "main": "backend/app.mo",
      "type": "motoko",
      "args": "--enhanced-orthogonal-persistence"
    }
}

```

A wasm file was compiled with EOP if the `enhanced-orthogonal-persistence` metadata section is set in the WASM.

> [@qwertytrewq](#):
>
> Also, it’s unclear, how to upgrade from 32 bit to EOP.

You can just `dfx deploy` over the existing wasm

---

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [March 24, 2025, 12:07pm UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/4 "2025-03-24T12:07:02Z")

</div>

> [@Vivienne](#):
>
> this needs to go in `canisters.<canister name>.args` for every canister.

Does it mean that `defaults.build.args` does not work? I wonder why it’s not highlighted as a wrong syntax in MS Code with the ICP extension.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 24, 2025, 12:09pm UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/5 "2025-03-24T12:09:37Z")

</div>

It is a valid field, but I don’t remember what it is used for

---

<div class="post-metadata">

**Author:** ![theoman42](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/theoman42/32/23829_2.png) [@theoman42](https://forum.dfinity.org/u/theoman42)\
**Post date:** [July 7, 2025, 4:38am UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/6 "2025-07-07T04:38:49Z")

</div>

Hey, my issue is along the same lines. I get the following error:

> ➜ coinflip git:(main) ✗ dfx canister install indexer\_backend --mode upgrade --ic  
> Error: Failed to install wasm module to canister ‘indexer\_backend’.  
> Caused by: Failed during wasm installation call  
> Caused by: The replica returned a rejection error: reject code CanisterError, reject message Missing upgrade option: Enhanced orthogonal persistence requires the `wasm_memory_persistence` upgrade option., error code Some(“IC0504”)

even though I have all the appropriate arguments in place?

```
"indexer_backend": {
  "declarations": {
    "node_compatibility": true
  },
  "main": "src/backend/indexer_backend/main.mo",
  "type": "motoko",
  "args": "--enhanced-orthogonal-persistence",
  "wasm_memory_persistence": "keep"
},

```

I originally didn’t include wasm\_memory\_persistence, thought including this would fix it, but it didn’t, still the same error.

@claudio lays out this option [here](https://internetcomputer.org/docs/motoko/fundamentals/actors/orthogonal-persistence/enhanced), but @Vivienne you don’t mention it above, so I am a bit confused.

 ![CleanShot 2025-07-07 at 13.34.36@2x](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/4/1/41c5176969d7d4e701dc451f3b71432e864378fa.jpeg)

Also, is it necessary to declare the actor as persistant? I am currently not.

> actor class Indexer() {  
> }

Thank you in advance for any help!

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [July 7, 2025, 7:41am UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/7 "2025-07-07T07:41:03Z")

</div>

> [@theoman42](#):
>
> `"wasm_memory_persistence": "keep"`

This is not valid in dfx.json, but dfx should auto-set it. If you want you can try installing with `--wasm-memory-persistence keep`

---

<div class="post-metadata">

**Author:** ![theoman42](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/theoman42/32/23829_2.png) [@theoman42](https://forum.dfinity.org/u/theoman42)\
**Post date:** [July 7, 2025, 1:17pm UTC](https://forum.dfinity.org/t/how-to-check-for-enhanced-orthogonal-persistence-bug/42830/8 "2025-07-07T13:17:18Z")

</div>

Adding it as a flag worked! thank you
