Jira logs are spammed with "Unexpected error executing rule with context TenantContext" errors when using an automation rule with a ScriptRunner trigger
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The Jira Application logs are spammed with ERRORS with following stack trace:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
automation-rule-executor:thread-1 ERROR mlim [c.c.a.api.service.SingleRuleExecutorServiceImpl] Unexpected error executing rule with context TenantContext{environment=prod, clientKey='com.codebarrel.tenant.global', tenantId=TenantId{id='00000000-0000-0000-0000-000000bbbbbb'}}: AutomationEvent{traceId=f66c25c4-47cf-4959-ac88-ff1f563dc018, clientKey='com.codebarrel.tenant.global', triggerType=THIRD_PARTY_EVENT, type='com.onresolve.jira.groovy.groovyrunner:object-bean-updated-trigger', projectIds=[], timestamp=Tue Dec 19 06:46:29 UTC 2023, authorAccountId='JIRAUSER10000', auditItemBatchId=null, payload=‘OBJECT-42', ignoreOwnEvents=true, authorAutomationAddon=false, priority=5}
com.codebarrel.api.JsonSupport$JsonDeserializationException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'OBJECT': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (ByteArrayInputStream); line: 1, column: 9]
at com.codebarrel.api.JsonSupport.toObject(JsonSupport.java:107)
at com.codebarrel.api.JsonSupport.toObject(JsonSupport.java:124)
at com.codebarrel.automation.api.event.AutomationEvent.getPayload(AutomationEvent.java:106)
at com.codebarrel.automation.rulecomponent.jira.trigger.fieldchanged.FieldChangedTriggerExecutor.canHandle(FieldChangedTriggerExecutor.java:73)
at com.codebarrel.automation.api.service.SingleRuleExecutorServiceImpl.validateExecution(SingleRuleExecutorServiceImpl.java:160)
at com.codebarrel.jira.plugin.automation.queue.JiraAutomationQueueExecutor.lambda$processClaimedItem$1(JiraAutomationQueueExecutor.java:253)
at com.codebarrel.jira.plugin.automation.service.execution.JiraThreadLocalExecutor.executeAsWithResult(JiraThreadLocalExecutor.java:67)
at com.codebarrel.jira.plugin.automation.service.execution.JiraThreadLocalExecutor.executeAsWithResult(JiraThreadLocalExecutor.java:53)
at com.codebarrel.jira.plugin.automation.queue.JiraAutomationQueueExecutor.lambda$processClaimedItem$4(JiraAutomationQueueExecutor.java:252)
at com.atlassian.jira.util.concurrent.BoundedExecutor$1.run(BoundedExecutor.java:50)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token ‘OBJECT’: was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (ByteArrayInputStream); line: 1, column: 9]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:745)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3635)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2734)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:902)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:794)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4761)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4667)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3666)
at com.codebarrel.api.JsonSupport.toObject(JsonSupport.java:105)
... 12 more
Diagnosis
The Scriptrunner add-on is installed on the instance at version 8.12.0 or 8.18.0 and 8.20.0 and Jira Assets up is in use.
There is at least one Automation Rule that is configured using the Assets object updated trigger which is coming from the Scriptrunner add-on, which is currently in "Beta":
Cause
Whenever a Assets object updated trigger is in any automation for Jira rule and the rule is enabled, simply every asset update will cause ScriptRunner's asset Trigger to throw above exception into Jira application logs. This issue is caused by a ScriptRunner bug, which is tracked in the public ticket SRJIRA-6983.
Solution
The workaround would be to be to increase the log level of com.codebarrel.automation.api.service.SingleRuleExecutorServiceImpl to FATAL by following Logging and Profiling. Note: However please note that this might hide relevant Automation for Jira errors, therefore it is not an ideal workaround.
Was this helpful?