# Error: The certificate contains a delegation that does not include the canister aaaaa-aa in the canister\_ranges field

**URL:** <https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766>\
**Category:** JavaScript\
**Created:** [September 21, 2025, 2:25am UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766 "2025-09-21T02:25:57Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [September 22, 2025, 7:29pm UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766/22 "2025-09-22T19:29:23Z")

</div>

Thanks @marc0olo.

I was able to reproduce the issue by cloning the repo and running the script locally. After debugging, I managed to isolate the problem and find a solution.

The code fails when calling `provisional_create_canister_with_cycles` if no canister ID is provided. This happens because the `canisterId` parameter is mapped to the `effectiveCanisterId` through the `specified_id` and `transform` function I mentionned earlier. That’s why providing one works, and leaving it empty does not.

If I supply a canister ID (for example, the one I use by default in Juno’s Docker setup), the script runs successfully and the canister is created.

```auto
const result = await this.management.provisionalCreateCanisterWithCycles({
  amount: cyclesToUse,
  canisterId: Principal.fromText('jx5yt-yyaaa-aaaal-abzbq-cai') // <----- 👀
});

```

> Canister created successfully with provisional function!  
> Canister ID: jx5yt-yyaaa-aaaal-abzbq-cai
> 
> 🎉 SUCCESS! Canister created successfully!

@Huygon764 can you give this a try specifying a canister ID?

@mraszyk @ilbert given the above, should we go ahead and implement the fix you suggested today or other ideas?

---

<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:** [September 23, 2025, 9:19am UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766/23 "2025-09-23T09:19:20Z")

</div>

> [@peterparker](#):
>
> implement the fix you suggested today or other ideas

An alternative would to be to default to the effective canister ID provided in PocketIC topology record. Actually maybe that’s better after all.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [September 23, 2025, 2:55pm UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766/24 "2025-09-23T14:55:21Z")

</div>

> [@mraszyk](#):
>
> An alternative would to be to default to the effective canister ID provided in PocketIC topology record.

Do you mean in the `ic-management` JS library? Not against sure, what’s the default or how can it be retrieved?

---

<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:** [September 23, 2025, 4:34pm UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766/25 "2025-09-23T16:34:36Z")

</div>

I mean in pic-js when creating a canister.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [September 23, 2025, 4:58pm UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766/26 "2025-09-23T16:58:02Z")

</div>

Ah gotcha. @ilbert WDYT?

Though OP is not using pic-js I think, probably rather DFX/PocketIC directly.

---

<div class="post-metadata">

**Author:** ![ilbert](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ilbert/32/8717_2.png) [@ilbert](https://forum.dfinity.org/u/ilbert)\
**Post date:** [September 23, 2025, 6:59pm UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766/27 "2025-09-23T18:59:25Z")

</div>

> [@mraszyk](#):
>
> I mean in pic-js when creating a canister.

> [@peterparker](#):
>
> @ilbert WDYT?

Makes sense! I’ve opened an issue for this: [Pass the canister id when calling `provisionalCreateCanisterWithCycles` · Issue #189 · dfinity/pic-js · GitHub](https://github.com/dfinity/pic-js/issues/189).

---

<div class="post-metadata">

**Author:** ![neeboo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/neeboo/32/981_2.png) [@neeboo](https://forum.dfinity.org/u/neeboo)\
**Post date:** [November 18, 2025, 2:51am UTC](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766/28 "2025-11-18T02:51:48Z")

</div>

I had the problem on my local machine as well.

provisionalCreateCanisterWithCycles:

```auto
The certificate contains a delegation that does not include the canister aaaaa-aa in the canister_ranges field

```

59 | \*/  
60 | get isCertified() {  
61 | return this.code.isCertified;  
62 | }  
63 | constructor(code, kind) {  
64 | super(code.toString());  
^  
TrustError: The certificate contains a delegation that does not include the canister aaaaa-aa in the canister\_ranges field. Subnet ID: gnkm6-o3f2j-s4j4o-tn4cp-ebkfd-46tuv-xaitz-fv54k-u7b2d-ejijp-vqe  
cause: {  
code: [Object …],  
kind: “Trust”,  
},

similarly

createCanister/installCode

```auto
Canister aaaaa-aa does not belong to any subnet.

```

[Previous page](https://forum.dfinity.org/t/error-the-certificate-contains-a-delegation-that-does-not-include-the-canister-aaaaa-aa-in-the-canister-ranges-field/57766.md?page=1)
