slack build failed template nullpointerexception
[2016-08-18 13:14:32,218] WARN - ildServer.util.EventDispatcher - Error in event handler: java.lang.NullPointerException
java.lang.NullPointerException
at webhook.teamcity.payload.format.WebHookPayloadJsonTemplate.getStatusAsString(WebHookPayloadJsonTemplate.java:43)
at webhook.teamcity.payload.format.WebHookPayloadGeneric.buildFinished(WebHookPayloadGeneric.java:64)
at webhook.teamcity.WebHookContentBuilder.buildWebHookContent(WebHookContentBuilder.java:78)
at webhook.teamcity.WebHookListener.processBuildEvent(WebHookListener.java:78)
at webhook.teamcity.WebHookListener.buildFinished(WebHookListener.java:138)
at sun.reflect.GeneratedMethodAccessor337.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:121)
at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.superDispatch(ServerSideEventDispatcher.java:6)
at jetbrains.buildServer.serverSide.ServerSideEventDispatcher$1.run(ServerSideEventDispatcher.java:1)
at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAs(SecurityContextImpl.java:3)
at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAsSystem(SecurityContextImpl.java:11)
at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.dispatch(ServerSideEventDispatcher.java:12)
at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:68)
at com.sun.proxy.$Proxy19.buildFinished(Unknown Source)
at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.finishBuild(RunningBuildsManagerImpl.java:24)
at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.access$600(RunningBuildsManagerImpl.java:198)
at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl$5.run(RunningBuildsManagerImpl.java:2)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Can I get some more detail on this? Like example config files.
Here is this:
# cat pluginData/plugin-settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<webhooks enabled="true">
<webhook url="https://hooks.slack.com/services/xxxxxxx" enabled="true" format="jsontemplate" template="slack.com">
<states>
<state type="buildBroken" enabled="false" />
<state type="changesLoaded" enabled="false" />
<state type="buildInterrupted" enabled="false" />
<state type="buildFixed" enabled="false" />
<state type="buildFinished" enabled="true" />
<state type="buildStarted" enabled="false" />
<state type="responsibilityChanged" enabled="false" />
<state type="buildSuccessful" enabled="true" />
<state type="buildFailed" enabled="true" />
<state type="beforeBuildFinish" enabled="false" />
</states>
<build-types enabled-for-all="true" enabled-for-subprojects="true" />
</webhook>
</webhooks>
</settings>
Are there any other config files that would be helpful? If it helps I'm on TC 10.0.1
So I was able to fix it by fixing another thing that was bothering me. By VCS config had an unnecessary branch spec. When I cleared the branch spec (it was just to make the long branch name shorter) then it all works.

Hmm, interesting. I've not played with branchSpec before. I'll leave this issue open, but low priority.
I seem to have the same issue This is on TeamCity Enterprise 2018.1 (build 58245). The weird thing is how flaky it is, the webhook fires most of the time, just not always when it should.
Error calling method BuildServerListener.buildFinished for listener webhook.teamcity.WebHookListener: java.lang.NullPointerException
at jetbrains.buildServer.util.EventDispatcher$3.run(EventDispatcher.java:146)
at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76)
at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:120)
at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.superDispatch(ServerSideEventDispatcher.java:7)
at jetbrains.buildServer.serverSide.ServerSideEventDispatcher$1.run(ServerSideEventDispatcher.java:1)
at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAs(SecurityContextImpl.java:43)
at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAsSystem(SecurityContextImpl.java:41)
at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.dispatch(ServerSideEventDispatcher.java:12)
at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:70)
at com.sun.proxy.$Proxy21.buildFinished(Unknown Source)
at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.finishBuild(RunningBuildsManagerImpl.java:154)
at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.lambda$scheduleBuildFinishing$1(RunningBuildsManagerImpl.java:205)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
Hi which version of the tcWebHooks plugin are you using?
Also, @mmalvik, are you using branchSpec too?
We are using 1.1.-alpha7.122.138

Looks like we are 2 years behind... 😅 You think an update might fix it?
Yes, we have branch spec set to +:refs/heads/*
Oh, that branchSpec should be fine. I use that one all the time too. I probably should have asked if you have variables in the branch spec.
I haven't done anything specific to fix this issue, but I would recommend updating as there are many many bug fixes and improvements.
Btw. Looking at the stack trace, I'm not convinced you're seeing the same issue as Aaron was. Please do update, let me know if you see the issue again.
I will keep an eye out for this and update if I see it again ✔️
Sorry, bumping this to 1.3