# Cannot call get with undefined key / Post.get is not a function

**URL:** https://meta.discourse.org/t/cannot-call-get-with-undefined-key-post-get-is-not-a-function/45160
**Category:** Development
**Created:** [June 2, 2016, 9:23pm UTC](https://meta.discourse.org/t/cannot-call-get-with-undefined-key-post-get-is-not-a-function/45160 "2016-06-02T21:23:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ivanrlio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivanrlio/32/48497_2.png) [@ivanrlio](https://meta.discourse.org/u/ivanrlio)
#### Post date: [June 2, 2016, 9:23pm UTC](https://meta.discourse.org/t/cannot-call-get-with-undefined-key-post-get-is-not-a-function/45160/1 "2016-06-02T21:23:00Z")

</div>

On my local machine I am using the latest version of Discourse. When I attempt to add a reply `within a topic`, I get the following error message:

 ![](https://global.discourse-cdn.com/meta/original/3X/5/0/50eed8609c5cf9517d8c7e3da2b43231d035d6b8.png)

The `post.get` error occurs in this bit of code:

 ![](https://global.discourse-cdn.com/meta/original/3X/3/6/36b342b9d0f920e4d0d360452f173d18138a2564.png)

I did a `console.log(post)` to see what it contained and the result was an object that has a post number of `(...)` . EDIT: Clicking on (…) yielded 1.

Additionally, when I try to add a `New Topic` (within the pipeline or in a topic), I get the error:

 ![](https://global.discourse-cdn.com/meta/original/3X/9/3/931070a6d37ece34915b44ff606e02a645539796.png)

Would anyone know how to rectify this? Thanks!

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [June 3, 2016, 9:22am UTC](https://meta.discourse.org/t/cannot-call-get-with-undefined-key-post-get-is-not-a-function/45160/2 "2016-06-03T09:22:53Z")

</div>

Are you sure `post` is an Ember object? Have you tried `post.post_number`?

---

<div class="post-metadata">

### Author: ![ivanrlio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivanrlio/32/48497_2.png) [@ivanrlio](https://meta.discourse.org/u/ivanrlio)
#### Post date: [June 3, 2016, 5:17pm UTC](https://meta.discourse.org/t/cannot-call-get-with-undefined-key-post-get-is-not-a-function/45160/3 "2016-06-03T17:17:47Z")

</div>

Isolated it down to something in two of our plugins, both of which reopen the composer controller.

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [August 14, 2021, 9:03pm UTC](https://meta.discourse.org/t/cannot-call-get-with-undefined-key-post-get-is-not-a-function/45160/4 "2021-08-14T21:03:32Z")

</div>

In my local development, working on a plugin, I get a similarly strange behavior with respect to the composer.

The create topic button works in my local discourse instance, but then if I try to add a new create topic button somewhere else (and add some code to make that happen), it messes up, and all create topic buttons throughout the (local) site stop working.

And I get this error:

`Uncaught Error: Assertion Failed: The key provided to set must be a string or number, you passed undefined`

This continues even if I remove the code I added that seemed to cause the error in the first place. That is, once I get this error, even if I return all the code back to the way it was before, the error keeps coming up anytime I want to hit the create topic button.

The only thing that, I think, makes the error goes away, is if I remove the file entirely where the new code was (so, not having the file there–seems to work; having the file there with no code in it–the error continues).

Does anyone have any idea about this? It’s been a big hindrance to my development.
