# Naming requirements for canister methods

**URL:** <https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483>\
**Category:** Developers\
**Created:** [March 17, 2025, 1:04pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483 "2025-03-17T13:04:50Z")\
**Posts on this page:** 7\
**Page:** 1

<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:** [March 17, 2025, 1:04pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483/1 "2025-03-17T13:04:50Z")

</div>

Do canister methods actually have any specific naming requirements? In the code, we seem to use strings, but are there any restrictions, such as minimum or maximum length, or any characters that are not allowed, etc.?

---

<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 17, 2025, 1:30pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483/2 "2025-03-17T13:30:23Z")

</div>

There’s a [restriction](https://internetcomputer.org/docs/references/ic-interface-spec#system-api-module) on the total length of the exported functions: their joint length must not exceed 20,000. Moreover, the name must be a valid UTF-8 string.

---

<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:** [March 17, 2025, 1:47pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483/3 "2025-03-17T13:47:04Z")

</div>

Interesting! Now I’m wondering how I would set up a Zod rule to validate the overall 20,000 length, but I’m going to leave it in the backlog for now 😄.

Really good to know—thanks, @mraszyk!

---

<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 17, 2025, 2:00pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483/4 "2025-03-17T14:00:24Z")

</div>

> [@mraszyk](#):
>
> There’s a [restriction](https://internetcomputer.org/docs/references/ic-interface-spec#system-api-module)

Is there a CLI tool that prints out how close a canister is to each of these limits below (from the provided link)?

- The IC may reject WebAssembly modules that
  - declare more than 50,000 functions, or
  - declare more than 1,000 globals, or
  - declare more than 16 exported custom sections (the custom section names with prefix `icp:`), or
  - the number of all exported functions called `canister_update <name>`, `canister_query <name>`, or `canister_composite_query <name>` exceeds 1,000, or
  - the sum of `<name>` lengths in all exported functions called `canister_update <name>`, `canister_query <name>`, or `canister_composite_query <name>` exceeds 20,000, or
  - the total size of the custom sections (the sum of `<name>`lengths in their names `icp:public <name>` and `icp:private <name>` plus the sum of their content lengths) exceeds 1MiB.

---

<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:** [March 17, 2025, 3:21pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483/5 "2025-03-17T15:21:56Z")

</div>

I don’t know the answer, but reading your message made me think that those assertions related to sections would suit `ic-wasm` well (if not yet implemented).

---

<div class="post-metadata">

**Author:** ![bitdivine](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bitdivine/32/246_2.png) [@bitdivine](https://forum.dfinity.org/u/bitdivine)\
**Post date:** [March 17, 2025, 4:16pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483/6 "2025-03-17T16:16:59Z")

</div>

That sounds like a challenge: Can you use an empty string as a canister method name? 😉

---

<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:** [March 17, 2025, 4:27pm UTC](https://forum.dfinity.org/t/naming-requirements-for-canister-methods/42483/7 "2025-03-17T16:27:12Z")

</div>

Now I wish I could use a smiley for method names. 😆
