# Testing Creation of Canister on a subnet using Cycle Minting Canister with PocketIC

**URL:** <https://forum.dfinity.org/t/testing-creation-of-canister-on-a-subnet-using-cycle-minting-canister-with-pocketic/26906>\
**Category:** Rust\
**Tags:** nns\
**Created:** [January 23, 2024, 4:39am UTC](https://forum.dfinity.org/t/testing-creation-of-canister-on-a-subnet-using-cycle-minting-canister-with-pocketic/26906 "2024-01-23T04:39:35Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [March 2, 2025, 9:46pm UTC](https://forum.dfinity.org/t/testing-creation-of-canister-on-a-subnet-using-cycle-minting-canister-with-pocketic/26906/21 "2025-03-02T21:46:49Z")

</div>

Just tried setting this up with pic locally, and when calling the `create_canister` API of the CMC I’m not specifying a subnet at all (null `subnet_selection`) and am getting the following error:

```auto
Mar 02 21:35:11.802 ERRO s:/n:/ic_execution_environment/canister_manager Unable to generate new canister IDs: Canister ID allocation was consumed
381523021 UTC: [Canister rkp4c-7iaaa-aaaaa-aaaca-cai] [cycles] Creating canister in subnet o5sz6-2cs3n-v2xts-gcvrz-ozndz-2gohh-vchh7-mieh4-vhg4e-z5tp6-vqe failed with code 1: Could not create canister. Subnet has surpassed its canister ID allocation.{additional_help}

```

This is how my PocketIC is currently set up (picJS)

```auto
const pic = await PocketIc.create(process.env.PIC_URL, {
    processingTimeoutMs: 60000,
    application: [
      {
        state: {
          type: SubnetStateType.New,
        },
      },
      {
        state: {
          type: SubnetStateType.New,
        },
      },
    ],
    // Additional configuration if needed
    nns: {
      state: {
        type: SubnetStateType.FromPath,
        path: NNS_STATE_PATH,
        subnetId: Principal.fromText(NNS_SUBNET_ID),
      },
    },
  });

```

Note that the code I have running to spin up a new canister currently works on mainnet.

Update: confirming that this also works with some of my older dfx tests that are directly hitting the old local full replica, but doesn’t work with the lighter pocket-ic replica.

---

<div class="post-metadata">

**Author:** ![mraszyk](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mraszyk/32/7945_2.png) [@mraszyk](https://forum.dfinity.org/u/mraszyk)\
**Post date:** [March 4, 2025, 1:02pm UTC](https://forum.dfinity.org/t/testing-creation-of-canister-on-a-subnet-using-cycle-minting-canister-with-pocketic/26906/22 "2025-03-04T13:02:27Z")

</div>

> [@icme](#):
>
> confirming that this also works with some of my older dfx tests that are directly hitting the old local full replica, but doesn’t work with the lighter pocket-ic replica

Please note that using the same pre-configured state for both replica and PocketIC could lead to unexpected results. In other words, state should not be shared between replica and PocketIC.

[Previous page](https://forum.dfinity.org/t/testing-creation-of-canister-on-a-subnet-using-cycle-minting-canister-with-pocketic/26906.md?page=1)
