# Key() method in Trie.find() giving an error. bare in mind this exact method and key is used in the file in several other places with no error

**URL:** <https://forum.dfinity.org/t/key-method-in-trie-find-giving-an-error-bare-in-mind-this-exact-method-and-key-is-used-in-the-file-in-several-other-places-with-no-error/7676>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [October 3, 2021, 6:32pm UTC](https://forum.dfinity.org/t/key-method-in-trie-find-giving-an-error-bare-in-mind-this-exact-method-and-key-is-used-in-the-file-in-several-other-places-with-no-error/7676 "2021-10-03T18:32:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jesse/32/37836_2.png) [@Jesse](https://forum.dfinity.org/u/Jesse)\
**Post date:** [October 3, 2021, 6:32pm UTC](https://forum.dfinity.org/t/key-method-in-trie-find-giving-an-error-bare-in-mind-this-exact-method-and-key-is-used-in-the-file-in-several-other-places-with-no-error/7676/1 "2021-10-03T18:32:21Z")

</div>

here is the code implementation:

 ![Screen Shot 2021-10-03 at 1.26.12 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/5/56fe397887bccc2524d8de36dba74ad8a12bcdbb.jpeg)

here is the key function:

 ![Screen Shot 2021-10-03 at 1.26.26 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/5/55db172a14fa8264139f858cdf681ad9755858aa.png)

here are the error messages :

 ![Screen Shot 2021-10-03 at 1.31.02 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/8/8746b9bbbfe0da5bc1b5888c9886dfe8ec681d76.png)

---

<div class="post-metadata">

**Author:** ![cryptoschindler](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/cryptoschindler/32/26_2.png) [@cryptoschindler](https://forum.dfinity.org/u/cryptoschindler)\
**Post date:** [October 3, 2021, 8:21pm UTC](https://forum.dfinity.org/t/key-method-in-trie-find-giving-an-error-bare-in-mind-this-exact-method-and-key-is-used-in-the-file-in-several-other-places-with-no-error/7676/2 "2021-10-03T20:21:45Z")

</div>

The third argument should be a function with the following signature according to the docs:  
`k_eq : (K, K) -> Bool`

I believe because you pass in a function call by specifying an argument, `key(callerId)` would be evaluted to type `Trie.Key<Principal>`.

But the main problem is probably that your `updateJournal` function takes a parameter called `key : ?Nat` which has precedence over the function declaration outside of the method, thus the type error (they `key` function and `key` parameter have the same name).

I’m on mobile so I can’t fact check this, hope it helps anyways!

---

<div class="post-metadata">

**Author:** ![Jesse](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jesse/32/37836_2.png) [@Jesse](https://forum.dfinity.org/u/Jesse)\
**Post date:** [October 3, 2021, 11:36pm UTC](https://forum.dfinity.org/t/key-method-in-trie-find-giving-an-error-bare-in-mind-this-exact-method-and-key-is-used-in-the-file-in-several-other-places-with-no-error/7676/3 "2021-10-03T23:36:12Z")

</div>

You were indeed correct. I completely missed the fact that recycled that name. Thank you so much!
