Answers.Body: <p>I hit the same problem today. The problem appeared to be that the links in the nested  (or <li> for EPUB3, no difference) pointed to locations other than the parent  element. </p>
  
  <p>So this code caused the same error you got:
  <a href="https://i.sstatic.net/hOQ8o.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hOQ8o.png" alt="enter image description here"></a>
  The key is that, because of a quirk in InDesign export, the section head was created as a separate file. I went in and put the items into <code>pessoa_book_of_disquiet_text-8.xhtml</code>, like so</p>
  
  <p><a href="https://i.sstatic.net/i2XEL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/i2XEL.png" alt="enter image description here"></a>
  Voila, no more error. It looks like for Kindle, nested content has to be in the same file as the parent. To be clear, I had to move all the content into the file, not just change the names.</p>
  
  <p>Does this fix your problem?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-01T19:20:46.373Z
Answers.LastActivityDate: 2017-08-01T19:20:46.373Z
Answers.UserDisplayName: Chris
Answers.Body: <p>I had the same problem, was caused by repeated chapters.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-15T14:44:20.723Z
Answers.Text: Do you mean: "by including two versions of the same chapter."
Answers.UserDisplayName: idiotprogrammer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-17T18:27:20.877Z
Answers.Text: yes, by mistake I was repeating the same chapter twice in the TOC.
Answers.UserDisplayName: guerrerocarlos
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-20T03:41:37.083Z
Answers.Text: This was my issue as well, although I didn't grok your answer at first -- it would have been more clear to say 'it was caused by duplicate chapter names'.
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-13T10:58:37.487Z
Answers.LastActivityDate: 2017-04-13T10:58:37.487Z
Answers.UserDisplayName: guerrerocarlos
Answers.Body: <p>The key error is here: </p>
  
  <pre><code>Error(prcgen):E24011: TOC section scope is not 
  included in the parent chapter:Table of Contents
  </code></pre>
  
  <p>I'm not 100% sure what this means. Perhaps  5824-Section.xhtml seems to be causing the issue. (I'm assuming). </p>
  
  <p>It's very strange that the epub file validates. This is probably an issue with Kindlegen, but there are times when Calibre is incompatible with kindle.  </p>
  
  <p>Probably the strangest thing to me when I examine your epub file is that toc.xhtml (on line 24)  lists itself as an item in the TOC. Why is it linking to itself?  That is definitely something which might confuse Kindlegen. </p>
  
  <p>Kindle requires a virtual table of contents at the front of the ebook, and your toc.xhtml would normally contain links to all the chapters. This one does not do that. </p>
  
  <p>Unfortunately while it is relatively easy to figure out epub issues, Kindlegen sometimes produces strange errors, and the best solution is to keep removing chapters until you get a version that works. Then try to figure out why. </p>
  
  <p>Remember that with epubs you can rename them to zip files and then unzip the files to examine everything. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-20T00:51:10.813Z
Answers.LastActivityDate: 2017-02-20T00:51:10.813Z
Answers.UserDisplayName: idiotprogrammer
Answers.Body: <p>Thanks to this thread I managed to solve the same issue. It may be a really (pre-covid!) old thread now but i thought I'd add how i did it in case anyone else struggles.
  Open Calibre
  Click on Edit Book
  Click on Tools
  Open TOC (Table of Contents)
  Click 'Edit TOC'
  Down the left side will be 'openable' chapters, open them up one by one and highlight 'Untitled' and move across to the right and click 'Remove Entry'.
  Do this for all the Untitled entries and/or anything repeated and then click ok and re-save your book.
  This should then open as an EPub.</p>
  <p>I hope this helps someone.</p>
  <p>Mark</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-22T08:48:47.643Z
Answers.LastActivityDate: 2023-04-22T08:48:47.643Z
Answers.UserDisplayName: Mark Roberts
Answers.Body: <p>It seems that kindlegen does not like duplicated names in the TOC. I ran across this issue and was only able to resolve when I renamed one of my headers. For reference, I am using Pandoc to generate the ePub file, with a TOC depth of 3. In this particular case, I had an H2 and an H3 with the same name. I renamed the H3 to be unique and the problem disappeared.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-20T03:38:19.280Z
Answers.LastActivityDate: 2018-02-20T03:38:19.280Z
Answers.UserDisplayName: Ben
Answers.Body: <p>some chapters are linking same name or same id that's called an error.</p>
  
  <p>for example: 
   <li>Chapter 1</li>
   <li>Chatper 2</li></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T10:39:46.850Z
Answers.LastActivityDate: 2018-04-14T10:39:46.850Z
Answers.UserDisplayName: magesh
Body: <p>My epub files pass epubcheck, but Kindlegen refuses to generate mobi files. It seems that issue is caused by adding references ("colophon", "dedication", etc.) to pages.</p>
  
  <p>I'm really hitting a wall here. I would really appreciate some EPUB</p>
  
  <p>FILE + ERROR LOGS: <a href="https://we.tl/UtGqtAxbir" rel="nofollow noreferrer">https://we.tl/UtGqtAxbir</a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-16T20:34:44.830Z
Comments.Text: Hi and welcome on this site; I've read your question and it is not clear what your problem is or what you are asking here; and, linking to a downloadable file without even explaining what it is supposed to be is not a good practice. You should try to improve your question.
Comments.UserDisplayName: Sekhemty
Tags: <kindle><epub>
Title: TOC section scope is not included in the parent chapter:Table of Contents
UserDisplayName: bookbinder
ThreadText: # TOC section scope is not included in the parent chapter:Table of Contents
  
  (Asked by: username_0 on 2017-02-16)
  
  My epub files pass epubcheck, but Kindlegen refuses to generate mobi files. It seems that issue is caused by adding references ("colophon", "dedication", etc.) to pages.
  
  I'm really hitting a wall here. I would really appreciate some EPUB
  
  FILE + ERROR LOGS: <https://we.tl/UtGqtAxbir>
  
  **Tags:** kindle, epub
  
  > **Comments:**
  > **username_1**: Hi and welcome on this site; I've read your question and it is not clear what your problem is or what you are asking here; and, linking to a downloadable file without even explaining what it is supposed to be is not a good practice. You should try to improve your question.  
  
  ---
  
  ## 6 answers
  
  ### Answer by username_2 on 2017-08-01. Score: 1
  
  I hit the same problem today. The problem appeared to be that the links in the nested (or
  
  - for EPUB3, no difference) pointed to locations other than the parent element.
  
    So this code caused the same error you got:
    [![enter image description here](https://i.sstatic.net/hOQ8o.png)](https://i.sstatic.net/hOQ8o.png)
    The key is that, because of a quirk in InDesign export, the section head was created as a separate file. I went in and put the items into `pessoa_book_of_disquiet_text-8.xhtml`, like so
  
    [![enter image description here](https://i.sstatic.net/i2XEL.png)](https://i.sstatic.net/i2XEL.png)
    Voila, no more error. It looks like for Kindle, nested content has to be in the same file as the parent. To be clear, I had to move all the content into the file, not just change the names.
  
    Does this fix your problem?
  
  
  ---
  
  ### Answer by username_3 on 2017-04-13. Score: 1
  
  I had the same problem, was caused by repeated chapters.
  
  > **Comments:**
  > **username_4**: Do you mean: "by including two versions of the same chapter."  
  > **username_3**: yes, by mistake I was repeating the same chapter twice in the TOC.  
  > **username_5**: This was my issue as well, although I didn't grok your answer at first -- it would have been more clear to say 'it was caused by duplicate chapter names'.  
  
  ---
  
  ### Answer by username_4 on 2017-02-20. Score: 0
  
  The key error is here:
  
  ```
  Error(prcgen):E24011: TOC section scope is not 
  included in the parent chapter:Table of Contents
  
  ```
  
  I'm not 100% sure what this means. Perhaps 5824-Section.xhtml seems to be causing the issue. (I'm assuming).
  
  It's very strange that the epub file validates. This is probably an issue with Kindlegen, but there are times when Calibre is incompatible with kindle.
  
  Probably the strangest thing to me when I examine your epub file is that toc.xhtml (on line 24) lists itself as an item in the TOC. Why is it linking to itself? That is definitely something which might confuse Kindlegen.
  
  Kindle requires a virtual table of contents at the front of the ebook, and your toc.xhtml would normally contain links to all the chapters. This one does not do that.
  
  Unfortunately while it is relatively easy to figure out epub issues, Kindlegen sometimes produces strange errors, and the best solution is to keep removing chapters until you get a version that works. Then try to figure out why.
  
  Remember that with epubs you can rename them to zip files and then unzip the files to examine everything.
  
  
  ---
  
  ### Answer by username_6 on 2023-04-22. Score: 0
  
  Thanks to this thread I managed to solve the same issue. It may be a really (pre-covid!) old thread now but i thought I'd add how i did it in case anyone else struggles.
  Open Calibre
  Click on Edit Book
  Click on Tools
  Open TOC (Table of Contents)
  Click 'Edit TOC'
  Down the left side will be 'openable' chapters, open them up one by one and highlight 'Untitled' and move across to the right and click 'Remove Entry'.
  Do this for all the Untitled entries and/or anything repeated and then click ok and re-save your book.
  This should then open as an EPub.
  
  I hope this helps someone.
  
  Mark
  
  
  ---
  
  ### Answer by username_5 on 2018-02-20. Score: 0
  
  It seems that kindlegen does not like duplicated names in the TOC. I ran across this issue and was only able to resolve when I renamed one of my headers. For reference, I am using Pandoc to generate the ePub file, with a TOC depth of 3. In this particular case, I had an H2 and an H3 with the same name. I renamed the H3 to be unique and the problem disappeared.
  
  
  ---
  
  ### Answer by username_7 on 2018-04-14. Score: -1
  
  some chapters are linking same name or same id that's called an error.
  
  for example:
  
  - Chapter 1
  - Chatper 2
  
  
  ---
  
  