Null Pointer Exception When Running Plan On Remote Agent
Asked by Kyle Seman:

I have had a set of Bamboo plans running for quite awhile but this morning Bamboo has decided to start throwing an exception when running them. The instance of Bamboo is on Linux but the plans themselves are ran from a remote agent running Windows. Specifically these are plans set to build .net framework mvc applications.

The plans fail at different tasks but both with the same error. The error below fails while trying to restore nuget packages but another plan fails while attempting to run a copy command. Running the nuget restore outside of Bamboo runs correctly.

I have tried cloning the plan and also reinstalled the remote agent but neither fixed the issue.

```
error 13-Aug-2020 07:36:50 Error occurred while running Task 'Nuget(8)' of type com.atlassian.bamboo.plugins.scripttask:task.builder.command.error 13-Aug-2020 07:36:50 com.atlassian.bamboo.task.TaskException: Failed to execute taskerror 13-Aug-2020 07:36:50 at com.atlassian.bamboo.plugins.shell.task.AbstractShellBuildTask.execute(AbstractShellBuildTask.java:65)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.plugins.shell.task.AbstractShellBuildTask.execute(AbstractShellBuildTask.java:39)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:288)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:221)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:288)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:110)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:71)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:203)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:175)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:122)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:117)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)error 13-Aug-2020 07:36:50 at java.lang.Thread.run(Thread.java:748)error 13-Aug-2020 07:36:50 Caused by: java.lang.NullPointerExceptionerror 13-Aug-2020 07:36:50 at com.atlassian.bamboo.process.ExternalProcessBuilder.lambda$env$0(ExternalProcessBuilder.java:78)error 13-Aug-2020 07:36:50 at com.google.common.base.Predicates$CompositionPredicate.apply(Predicates.java:552)error 13-Aug-2020 07:36:50 at com.google.common.collect.Iterators$7.computeNext(Iterators.java:652)error 13-Aug-2020 07:36:50 at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)error 13-Aug-2020 07:36:50 at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)error 13-Aug-2020 07:36:50 at com.google.common.collect.Iterators.size(Iterators.java:191)error 13-Aug-2020 07:36:50 at com.google.common.collect.Collections2$FilteredCollection.size(Collections2.java:211)error 13-Aug-2020 07:36:50 at java.util.AbstractMap.size(AbstractMap.java:85)error 13-Aug-2020 07:36:50 at java.util.HashMap.putMapEntries(HashMap.java:501)error 13-Aug-2020 07:36:50 at java.util.HashMap.putAll(HashMap.java:785)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.process.ExternalProcessBuilder.env(ExternalProcessBuilder.java:78)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.process.ProcessServiceImpl.createExternalProcess(ProcessServiceImpl.java:144)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.process.ProcessServiceImpl.executeExternalProcess(ProcessServiceImpl.java:195)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.process.ProcessServiceImpl.executeExternalProcess(ProcessServiceImpl.java:210)error 13-Aug-2020 07:36:50 at com.atlassian.bamboo.plugins.shell.task.AbstractShellBuildTask.execute(AbstractShellBuildTask.java:48)error 13-Aug-2020 07:36:50 ... 17 more
```


Answers:
author: Alexey Chystoprudov
body: [@Kyle Seman](/t5/user/viewprofilepage/user-id/4050315) , please report issue at <https://getsupport.atlassian.com> .

Issue happens when Bamboo tries to read system properties, we need to get more information about environment and Bamboo version

comments: author: Kyle Seman
body: Thanks, I have submitted a support ticket.