[FIXED] Closing tag `ul` did not match last open tag `li`

I upgraded my project to the latest version of ember-cli:

$ ember -v
version: 0.2.2
node: 0.12.0
npm: 2.7.4

and refreshed the project as explained in the upgrade notes, including ember init.

However, although in the previous setup everything ran fine, and not having changed anything since, I get the following cryptic error message:

File: na-holland/templates/application.hbs
Closing tag `ul` (on line 99) did not match last open tag `li` (on line 98).
Error: Closing tag `ul` (on line 99) did not match last open tag `li` (on line 98).
    at validateEndTag (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3957:26)
    at HTMLProcessor.tokenHandlers.EndTag (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3928:9)
    at HTMLProcessor.acceptToken (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3780:47)
    at forEach (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:4340:20)
    at HTMLProcessor.nodeHandlers.ContentStatement (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3634:16)
    at HTMLProcessor.acceptNode (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3775:43)
    at HTMLProcessor.nodeHandlers.Program (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3573:16)
    at HTMLProcessor.acceptNode (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3775:43)
    at preprocess (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:3747:55)
    at compileSpec (/home/kiffin/projects/ember/cli/na-mockup/bower_components/ember/ember-template-compiler.js:703:17)

This is strange.

First of all the line number does not match the application.hbs file contents, and if I empty the contents completely, I still get the same message.

Also, going into undex.html and stripping the {{content-for ...} stuff out like doesn’t seem to help either.

What am I doing wrong and how can I correct this bizarre behavior?

If you were upgrading from a version before HTMLBars was introduced to Ember to Ember.js 1.11, the template parser now performs HTML validation.

The line numbers sadly can appear off (I’ve found it gets confused by multiple Handlebars expressions on a single line), but somewhere in your template you’re missing a closing , and the parser is encountering the next closing tag (an ), and throwing an error.

Previously this bug would not have been caught. The browser would have “helpfully” corrected this mistake for you, although sometimes its corrections can produce unpredictable results.

Unfortunately, I would have preferred just a warning and not an error that kills the application.

Like I said, even when I strip the templates of content (e.g. no html) I still get this error.

Could it be that some add-on is generating invalid html before it even hits my content?

Turns out that this was caused by an unrelated template reachable via a link within a template. Problem was a missing closing p-tag.

Should make the error message more accurate if possible.

Seems odd. Can you isolate to a test case or sample application?

Seems to be working now after I refreshed my project and ran npm/bower install.