`Unknown stage section "step". Starting with version 0.5, steps in a stage must be in a ‘steps’ block.`
BeginnerTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer
Likely causes → Typo step {} instead of steps {}, or steps written directly in the stage block.
Diagnose → The message includes line and column; open the Jenkinsfile there.
Fix →
stage('Build') { steps { sh 'make' } }
Prevent → Use the Declarative Directive Generator and an editor plugin with Jenkinsfile linting.
More on Jenkinsfile syntax, Groovy & CPS errors
`WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.`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`groovy.lang.MissingPropertyException: No such property: IMAGE_TAG for class: groovy.lang.Binding`Beginner