`java.lang.IllegalStateException: Jenkins.instance is missing` in a plugin or script.
AdvancedTroubleshootingJenkins Credentials, Plugins and Controller Issues
Answer
Likely causes → Code runs on an agent JVM instead of the controller, or Jenkins is shutting down.
Diagnose → Check where the code executes (inside a node block vs controller).
Fix → Move controller-API calls into @NonCPS library code running on the controller, not inside an agent-side closure.
Prevent → Avoid direct Jenkins.instance in pipelines.
More on Jenkins Credentials, Plugins and Controller Issues
`ERROR: Could not find credentials entry with ID 'docker-hub'`.BeginnerJenkins UI shows `HTTP ERROR 403 No valid crumb was included in the request`.BeginnerAfter upgrade, Jenkins shows `Jenkins failed to start` and logs `Failed Loading plugin ... Plugin is missing: ...`.AdvancedJenkins is extremely slow; the UI times out; thread dump shows many blocked threads.Advanced`java.lang.OutOfMemoryError: Java heap space` on the controller.Intermediate`No such property: env for class: groovy.lang.Binding` in a shared library.Advanced