# Error: Attempt to invoke bookmark for \[Function\]

**URL:** https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696
**Category:** Bugs
**Created:** [May 23, 2016, 2:45pm UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696 "2016-05-23T14:45:48Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![CryogenicMiner](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cryogenicminer/32/3985_2.png) [@CryogenicMiner](https://discourse.codecombat.com/u/CryogenicMiner)
#### Post date: [May 23, 2016, 2:45pm UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696/1 "2016-05-23T14:45:48Z")

</div>

###What does this error mean? `Error: Attempt to invoke bookmark for [function]`

* * *

All of a sudden I am getting this error a lot: `Error: Attempt to invoke bookmark for [Function]`. I do know know what causes the error, the error appears most often when I use `hero.say()`.  
Thank you.  
-Cheers!

---

<div class="post-metadata">

### Author: ![Serg](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/serg/32/3260_2.png) [@Serg](https://discourse.codecombat.com/u/Serg)
#### Post date: [May 23, 2016, 4:41pm UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696/2 "2016-05-23T16:41:13Z")

</div>

Can you provide some code for which this is happening? We switched to a new interpreter and this error looks like it’s trying to tell you that you’re calling a function which you shouldn’t have access to in some form.

---

<div class="post-metadata">

### Author: ![CryogenicMiner](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cryogenicminer/32/3985_2.png) [@CryogenicMiner](https://discourse.codecombat.com/u/CryogenicMiner)
#### Post date: [May 23, 2016, 8:46pm UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696/3 "2016-05-23T20:46:40Z")

</div>

I have included my full code under the “Full Code” spoiler. The particular problem at the momment happens in this funciton:

```python
def histListFn(hist):
    hero.say("histListFn")
    histList = []
    for h in hist:
        histList.append(h)
    hero.say(histList)

```

The last line, `hero.say(histList)` returns the error. I do not see any reason for an error, although I could be mistaken. Though I can not remember, I know I have found this error a lot recently and had to stop developing my code. Thank you for takeing a look.  
-Cheers

> **Full Code**
>
> ```python
> ###-GENERATES-NONE-1to8-HISTOGRAM-###
> def blankHistFn():
> blankHist = {}
> for i in range(1, 9):
> blankHist[i] = 0
> return blankHist
> 
> ###-CONVERST-BOOLIAN-TO-INTERGER-###
> def boolInt(boolVar):
> intVar = 0
> if boolVar: intVar = 1
> return intVar
> 
> ###-RETURNS-THE-OCTANT-VALUE-PER-ITEM-###
> def octantFn(item):
> octantOpt = [([1, 2], [8, 7]), ([4, 3], [5, 6])]
> xPos = item['x']
> yPos = item['y']
> octant = octantOpt[boolInt(xPos < 0)][boolInt(yPos < 0)][boolInt(abs(xPos) < abs(yPos))]
> return octant   
> 
> ###-RETURNS-LIST-OF-ITEMS-W/-0,0-AT-HERO-###
> def heroCentered(stockItems, heroPos):
> heroCentricItems = [] 
> for item in stockItems: 
> nuePos = item.pos.subtract(heroPos)
> heroCentricItems.append(nuePos)
> #hero.say(heroCentricItems)
> #return heroCentricItems
> 
> ###-FILLS-HISTOGRAM-WITH-SET-DATA-###
> def itemHistogram(itemSet):
> itemHist = blankHistFn()
> for item in itemSet:
> octantVal = octantFn(item)
> itemHist[octantVal] += 1
> #hero.say(itemHist[octantVal])
> return itemHist
> 
> def highHistFn(hist):
> highHist = None
> for h in hist:
> hero.say(h)
> if hist[h] > hist[highHist]:
> hero.say("nue highest")
> highHist = h
>             
> #hero.say(hist[high])
> return highHist
> 
> def histListFn(hist):
> hero.say("histListFn")
> histList = []
> for h in hist:
> histList.append(h)
> hero.say(histList)
>     
> 
> ###-MASTER-FUNCTION-SETUP-###
> hero.say("Start MasterFunction") 
> 
> heroPos = hero.pos
> coins = hero.findByType("coin")
> nueCoins = heroCentered(coins, heroPos)
> hist = itemHistogram(nueCoins)
> hero.say(hist)
> 
> listHist = histListFn(hist)
> 
> ```

---

<div class="post-metadata">

### Author: ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)
#### Post date: [May 24, 2016, 4:37am UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696/4 "2016-05-24T04:37:18Z")

</div>

If I recall correctly, the error happens when you try to `say` an object whose `toString` method has been overridden by the Python runtime. I believe @rob can provide more details and correct me if I’m wrong.

---

<div class="post-metadata">

### Author: ![CryogenicMiner](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cryogenicminer/32/3985_2.png) [@CryogenicMiner](https://discourse.codecombat.com/u/CryogenicMiner)
#### Post date: [May 31, 2016, 10:19am UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696/5 "2016-05-31T10:19:35Z")

</div>

So, is there anything I can do? Or am I stuck unable to read lists.  
Thanks  
-Cheers

---

<div class="post-metadata">

### Author: ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)
#### Post date: [May 31, 2016, 7:26pm UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696/6 "2016-05-31T19:26:33Z")

</div>

I believe this is a bug in the engine that the developers should fix.

For the time being, you can use this hack (not really valid Python but it works):

```python
hero.say(histList.join(', '))

```

---

<div class="post-metadata">

### Author: ![CryogenicMiner](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cryogenicminer/32/3985_2.png) [@CryogenicMiner](https://discourse.codecombat.com/u/CryogenicMiner)
#### Post date: [June 2, 2016, 2:29pm UTC](https://discourse.codecombat.com/t/error-attempt-to-invoke-bookmark-for-function/7696/7 "2016-06-02T14:29:38Z")

</div>

Thank you! That seems to fix the problem for now. I hope the development team fixes the bug soon.  
-Cheers
