Hi Jenkins community,
We are seeing a job failure on Jenkins 2.462.3 (build running on an AWS EC2 agent) where the build fails very early during environment setup.
Error snippet from console log:
[EnvInject] - Loading node environment variables.
FATAL: Cannot invoke "java.util.Map.size()" because "m" is null
java.lang.NullPointerException: Cannot invoke "java.util.Map.size()" because "m" is null
at java.base/java.util.HashMap.putMapEntries(HashMap.java:503)
at java.base/java.util.HashMap.putAll(HashMap.java:791)
at org.jenkinsci.plugins.envinject.service.EnvironmentVariablesNodeLoader.gatherEnvVarsForNode(EnvironmentVariablesNodeLoader.java:68)
at org.jenkinsci.plugins.envinject.EnvInjectListener.loadEnvironmentVariablesNode(EnvInjectListener.java:78)
at org.jenkinsci.plugins.envinject.EnvInjectListener.setUpEnvironment(EnvInjectListener.java:42)
After this, multiple steps fail with workspace-related errors (likely cascading), for example:
ERROR: Step ‘GitHub PR: set PR status’ failed: no workspace for <job> #<build>
ERROR: Error: No workspace found!
Notes / environment:
- Jenkins version: 2.462.3
- Plugin visible in UI: EnvInject API 1.199.v3ce31253ed13
- We don’t clearly see the “EnvInject / Environment Injector” plugin in the plugin list, but the stacktrace shows
PluginClassLoader for envinject - Build is a Freestyle job triggered via GitHub PR build
Question:
Has anyone seen this EnvInject-related NPE on Jenkins 2.462.x?
What could cause gatherEnvVarsForNode() to receive a null map (m == null) while loading node environment variables?
Also, what is the recommended fix here:
- upgrade/remove EnvInject,
- disable node environment injection,
- or fix something specific in the EC2 agent/node configuration?
Any guidance or known issue links would be appreciated. Thanks!
Jenkins setup:2.462.3,
- Plugin visible in UI: EnvInject API 1.199.v3ce31253ed13