ERROR: Cannot resume build because FlowNode 19

Creating placeholder flownodes because failed loading originals.
ERROR: Cannot resume build because FlowNode 19 for FlowHead 1 could not be loaded. This is expected to happen when using the PERFORMANCE_OPTIMIZED durability setting and Jenkins is not shut down cleanly. Consider investigating to understand if Jenkins was not shut down cleanly or switching to the MAX_SURVIVABILITY durability setting which should prevent this issue in most cases.
Finished: FAILURE

Techs:–
Jenkins 2.414.1
Digital Ocean
Github

pipeline:–pipeline {
agent any

stages {
    stage('Build Front-End') {
        steps {
            dir('Front_End') {
                script {
                    try {
                        sh 'whoami'
                        sh 'npm install'
                        sh 'CI=false npm run build'
                    } catch (Exception e) {
                        currentBuild.result = 'FAILURE'
                        error("Frontend build failed: ${e.message}")
                    }
                }
            }
        }
    }

    stage('Deploy to DigitalOcean') {
        steps {
            script {
                sh 'pwd'
                sh 'ls'
                
                sh 'sudo rm -rf /var/www/react_cc/html'
                sh 'sudo mkdir -p /var/www/react_cc/html'
                sh 'ls -l /var/www/react_cc'
                sh 'sudo cp -R ./Front_End/build/* /var/www/react_cc/html/' 
            }
        }
    }
}

 post {
    failure {
        script {
            echo "Build #${currentBuild.number} failed. See below for details:"
            echo "${currentBuild.rawBuild.getLog(1000)}"
        }
        mail to: 'n160643@rguktn.ac.in',
            subject: "Failed React Project Deployment - Build #${currentBuild.number}",
            body: 'The React project deployment failed. Please check the Jenkins build logs for details.'
    }
    success {
         script {
            echo "Build #${currentBuild.number} success. See below for details:"
            echo "${currentBuild.rawBuild.getLog(1000)}"
        }
        mail to: 'n160643@rguktn.ac.in',
            subject: 'Successful React Project Deployment',
            body: 'The React project deployment was successful.'
    }
}

}

Help me in solving this and build a working pipeline

The error message you provided,

“Cannot resume build because FlowNode 19 for FlowHead 1 could not be loaded,”

is related to the durability setting used in Jenkins Pipelines. It suggests that you are using the PERFORMANCE_OPTIMIZED durability setting, which is more prone to issues if Jenkins is not shut down cleanly. :person_shrugging:

The error message suggests switching to the MAX_SURVIVABILITY durability setting. This setting is more robust and less likely to encounter issues related to Jenkins not shutting down cleanly. To change the durability setting for your pipeline, you can add the following line at the beginning of your pipeline script:

pipeline {
    agent any
    options {
        durabilityHint 'MAX_SURVIVABILITY'
    }
    // ...
}

By setting the durabilityHint to ‘MAX_SURVIVABILITY’, you ensure that the pipeline is less susceptible to issues related to Jenkins not shutting down cleanly.