Last modifiedby & filed under Kontakt Scripting (KSP) - Basics, UIs, Tutorials, Scripts and Tools, Kontakt Scripting (KSP) :: Tools & Troubleshoots.

If working on big Kontakt projects with large code segments inside the on init you may get confronted with the “parser stack overflow” error. This simple workaround shows how to avoid this error.

According to this post @ vi control you can only have a specific amount of code lines in the same statement level hierarchy – inside the on init. The limit is about 996 lines within each level.

So if we get the parser stack overflow error we can simply wrap some of our code parts inside an if clause which is always true. By this we put our code one hierarchy down. Like so:

on init
  // lots of code in the top level hierarchy
  if (1=1)
    //even more code in the second level hierarchy (+ 996 lines)
  end if
  if (1=1)
    // another code block in the second level hierarchy (+996 lines)
  end if
end on

The limit of 996 lines is not really verified. So just do this procedure for as many code blocks until the stack overflow error disappears.

Note: The total allowed lines of code inside the on init is still limited. But you should be good if you don’t exceed about 11.000 lines.


For macros it would just look like this:

macro xyz
		// your macro code
	end if
end macro


Related Posts / Source:


How useful was this article?

something you didn't like? Please tell us before you rate!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

NOTE: highly negative votes may be removed without any reasonable given feedback!

Tell us how we can improve this post?

Leave a Reply

use <pre> </pre> to wrap code blocks

use <code> </code> to wrap small code snippets

use basic html to style your comment

Your email address will not be published. Required fields are marked *