Interview Prep/Jenkins/Jenkinsfile syntax, Groovy & CPS errors

`java.io.NotSerializableException: groovy.json.internal.LazyMap`

IntermediateTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer

Likely causes → new JsonSlurper().parseText(...) returns a LazyMap, which is not serializable, and it is alive across a step.

Diagnose → Search the Jenkinsfile and library for JsonSlurper.

Fix → Use Pipeline Utility Steps: def data = readJSON text: response (returns serializable JSONObject), or JsonSlurperClassic inside a @NonCPS method returning plain maps.

Prevent → Standardize on readJSON/readYaml in the library.

All Jenkins questions Roadmap: Jenkins

More on Jenkinsfile syntax, Groovy & CPS errors