The build is aborted with `Cancelling nested steps due to timeout` during a test stage that normally takes 5 minutes.
IntermediateTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer
Likely causes → Stage timeout hit because tests hung (waiting on a network resource, deadlock) or because the timeout includes waiting for the agent pod to start.
Diagnose → Check timestamps (timestamps()), when the agent became available, and the last log lines before the timeout; take a thread dump in the test container if reproducible.
Fix → Fix the hang (add test-level timeouts, mock external calls). Put timeout inside the stage steps (not stage options) if pod startup time should not count.
Prevent → Test framework timeouts plus pipeline timeouts as a backstop.
More on Jenkinsfile syntax, Groovy & CPS errors
`WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.`Beginner`Unknown stage section "step". Starting with version 0.5, steps in a stage must be in a ‘steps’ block.`Beginner`java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, ...]`Beginner`java.io.NotSerializableException: java.util.regex.Matcher`Advanced`java.io.NotSerializableException: groovy.json.internal.LazyMap`Intermediate`org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object`Intermediate