Skip to content

[JENKINS-75875] Declarative pipeline "Method too large" after removing stage #1487

@jenkins-infra-bot

Description

@jenkins-infra-bot

Note: this is not "Method code too large" but "Method too large".

We've had this "big" declarative pipeline (~1800 LoC).
We've added stages, removed stages, added functions, etc...
We do not use shared libraries.

We also have the `SCRIPT_SPLITTING_TRANSFORMATION` enabled (true) and the `...LOCAL_VARIABLES` disabled (false by default), although we don't have variables declared outside (or inside) the pipeline.

Most of the stages are in the form of

stage("Name") {
  agent { stuff }
  steps {
    sh "stuff"
  }
  when {
    stuff
  }
}

And most of them are grouped inside parallel stages.

For professional reasons, I can't disclose the full pipeline.

 

Now, we removed a stage from the Jenkinsfile (as it was not needed/wanted anymore) and we started hitting this exception

General error during class generation: Method too large: WorkflowScript.___cps___146115 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;
 
groovyjarjarasm.asm.MethodTooLargeException: Method too large: WorkflowScript.___cps___146115 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;
    at groovyjarjarasm.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2087)
    at groovyjarjarasm.asm.ClassWriter.toByteArray(ClassWriter.java:447) 
(...)

 

I did some tests and the error appears after, at least, removing the `when` clause in the stage.
(Removing the whole stage also causes the problem).

I'm guessing this is a gray area between the `groupSize`/`declarationGroupSize` and the actual method sizes.

Given the different error message and slightly different stack trace, I couldn't tell if it was the same problem as JENKINS-37984 or JENKINS-56500.


Originally reported by tiago_teixeira_erx, imported from: Declarative pipeline "Method too large" after removing stage
  • status: Open
  • priority: Blocker
  • component(s): pipeline-model-definition-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 5
  • imported: 2025-12-06
Raw content of original issue

Note: this is not "Method code too large" but "Method too large".

We've had this "big" declarative pipeline (~1800 LoC). We've added stages, removed stages, added functions, etc... We do not use shared libraries.

We also have the `SCRIPT_SPLITTING_TRANSFORMATION` enabled (true) and the `...LOCAL_VARIABLES` disabled (false by default), although we don't have variables declared outside (or inside) the pipeline.

Most of the stages are in the form of

stage("Name") {
  agent { stuff }
  steps {
    sh "stuff"
  }
  when {
    stuff
  }
}

And most of them are grouped inside parallel stages.

For professional reasons, I can't disclose the full pipeline.

 

Now, we removed a stage from the Jenkinsfile (as it was not needed/wanted anymore) and we started hitting this exception

General error during class generation: Method too large: WorkflowScript.___cps___146115 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;
 
groovyjarjarasm.asm.MethodTooLargeException: Method too large: WorkflowScript.___cps___146115 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;
    at groovyjarjarasm.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2087)
    at groovyjarjarasm.asm.ClassWriter.toByteArray(ClassWriter.java:447) 
(...)

 

I did some tests and the error appears after, at least, removing the `when` clause in the stage. (Removing the whole stage also causes the problem).

I'm guessing this is a gray area between the `groupSize`/`declarationGroupSize` and the actual method sizes.

Given the different error message and slightly different stack trace, I couldn't tell if it was the same problem as JENKINS-37984 or JENKINS-56500.

environment
Jenkins 2.479.3<br/>
pipeline-model-definition 2.2255.v56a_15e805f12

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions