# What is kENSURE and kEND in error message?

**URL:** <https://www.ruby-forum.com/t/what-is-kensure-and-kend-in-error-message/168711>\
**Category:** Rails\
**Created:** [May 24, 2009, 9:30pm UTC](https://www.ruby-forum.com/t/what-is-kensure-and-kend-in-error-message/168711 "2009-05-24T21:30:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [May 24, 2009, 9:30pm UTC](https://www.ruby-forum.com/t/what-is-kensure-and-kend-in-error-message/168711/1 "2009-05-24T21:30:11Z")

</div>

I sometimes get an error on the page as:

```
compile error
/Users/jian/ror/shov2/app/views/stories/index.html.erb:13: syntax

```

error, unexpected kENSURE, expecting ‘)’  
/Users/jian/ror/shov2/app/views/stories/index.html.erb:15: syntax  
error, unexpected kEND, expecting ‘)’

the kEND, i can guess that it is End… so it means End of file but  
unexpected, there should be a ‘)’.

how about the kENSURE ? and… why the “k” attached in front? thanks.

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [May 24, 2009, 10:33pm UTC](https://www.ruby-forum.com/t/what-is-kensure-and-kend-in-error-message/168711/2 "2009-05-24T22:33:59Z")

</div>

SpringFlowers AutumnMoon wrote:

> how about the kENSURE ? and… why the “k” attached in front? thanks.

K is for keyword; the keyword ensure. It seems like you have a  
ensure…end block without the appropriate “begin”.

–  
Roderick van Domburg  
[http://www.nedforce.com](http://www.nedforce.com)

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [May 24, 2009, 10:50pm UTC](https://www.ruby-forum.com/t/what-is-kensure-and-kend-in-error-message/168711/3 "2009-05-24T22:50:18Z")

</div>

Roderick van Domburg wrote:

> SpringFlowers AutumnMoon wrote:
> 
> > how about the kENSURE ? and… why the “k” attached in front? thanks.
> 
> K is for keyword; the keyword ensure. It seems like you have a  
> ensure…end block without the appropriate “begin”.

ah, it actually happened with the \<%= # some code %\>

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [May 24, 2009, 10:56pm UTC](https://www.ruby-forum.com/t/what-is-kensure-and-kend-in-error-message/168711/4 "2009-05-24T22:56:01Z")

</div>

I think the problem is that seen with most languages, when you have a  
syntax  
error the message may appear to have little to do with the actual error  
as  
the parser has gone off down the wrong track but does not realise this  
until  
it is too late. Admittedly ruby does seem particularly poor at  
generating  
useful messages.

Colin

2009/5/24 SpringFlowers AutumnMoon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
