Groovy script cannot be executed due to "Method code too large" error

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible


Groovy script cannot be triggered due to the following error:

For example, an error similar to this one appears in the browser (example exception thrown from Insight Script Console, but similar exceptions can be thrown when using other plugins that run Groovy scripts):

class com.riadalabs.jira.plugins.insight.common.exception.GroovyInsightException

GroovyInsightException: startup failed: General error during class generation: Method code too large! java.lang.RuntimeException: Method code too large! at
groovyjarjarasm.asm.MethodWriter.getSize( at groovyjarjarasm.asm.ClassWriter.toByteArray( at
org.codehaus.groovy.control.CompilationUnit$ at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes( at
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation( at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations( at
org.codehaus.groovy.control.CompilationUnit.compile( at groovy.lang.GroovyClassLoader.doParseClass( at
groovy.lang.GroovyClassLoader.parseClass( at groovy.lang.GroovyShell.parseClass( at groovy.lang.GroovyShell.parse( at
groovy.lang.GroovyShell.evaluate( at groovy.lang.GroovyShell.evaluate( at groovy.lang.GroovyShell.evaluate( at at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at
java.lang.reflect.Method.invoke( at$ResponseOutInvoker.lambda$_dispatch$0( at$invokeMethodWithInterceptors$0( at at at at at$ResponseOutInvoker._dispatch( at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch( at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept( at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept( at 


Jira with a plugin that runs Groovy scripts (e.g. Scriptrunner, Insight).


  • The error started to appear suddenly, whilst the script code getting extended.
  • Some methods in the code got to large in size.
  • The code has grown and number of lines got rapidly increased.


This error basically means there is / are large methods in Groovy code: JVM has a limitation where a method cannot be larger than 64 kB. This means the behaviour is not caused by the triggering plugin itself, but it rather exists due to this JVM limitation.


The way to resolve this would be to rewrite / reorganize the code:

  • Split large methods in a number of smaller ones.
  • Check if the main method contains code that repeat itself consecutively (e.g. debugging function that keeps logging through code execution, like on the example screenshot in the "Problem" section). In that case, putting the code chunk in a loop would help to circumvent the limitation.


Additional information / articles about "Method code too large":

Last modified on Oct 13, 2021

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.