Strange Script Runner errors during Re-index of Jira 6.3.1 system

I am getting the following errors during a re-index of the system with Jira 6.3.1.

I can't find anything related to the error - userKey should not be null!

here are the complete errors in the logs -

2014-08-11 15:35:54,868 IssueIndexer:thread-3 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script2.run(Script2.groovy:11)

2014-08-11 15:35:54,875 IssueIndexer:thread-3 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script10.run(Script10.groovy:11)

2014-08-11 15:35:54,918 IssueIndexer:thread-3 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script24.run(Script24.groovy:11)

2014-08-11 15:35:55,493 IssueIndexer:thread-1 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script2.run(Script2.groovy:11)

2014-08-11 15:35:55,498 IssueIndexer:thread-1 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script10.run(Script10.groovy:11)

2014-08-11 15:35:55,524 IssueIndexer:thread-1 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script24.run(Script24.groovy:11)

2014-08-11 15:43:39,472 IssueIndexer:thread-6 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script2.run(Script2.groovy:11)

2014-08-11 15:43:39,484 IssueIndexer:thread-6 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script10.run(Script10.groovy:11)

2014-08-11 15:43:39,515 IssueIndexer:thread-6 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script24.run(Script24.groovy:11)

4 answers

1 accepted

I found out what the issue was - We have a custom user field named Customer and the scripted reads the public user properties from these users. Several entries had the users login I.D. set instead of the full name.

example Customer: asmith

Should have been set to Customer: Smith, Abby

Once it was changed to the full name, the errors are gone

The most recent release has better and more concise error messages for script field failures.

Most possible you've deleted some user that was used in configuration of the script custom field. You should review your existing script field and check if they contain proper data. Do you use those fields at all? Please check https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fieldsfor details

3.) Display Previous Issue Key Number

import com.atlassian.jira.ComponentManager

def componentManager = ComponentManager.getInstance()

def changeHistoryManager = componentManager.getChangeHistoryManager()

x = changeHistoryManager.getPreviousIssueKeys(issue.id)

if (x.join(' ') == "") {

return null

}

return x.join(' ')

4.) Display Parent Issue Custom Numeric Field on Sub-tasks

import com.atlassian.jira.issue.Issue;

import com.atlassian.jira.ComponentManager;

import com.atlassian.jira.issue.CustomFieldManager;

import com.atlassian.jira.issue.fields.CustomField;

import com.atlassian.jira.component.ComponentAccessor;

field = ComponentAccessor.getCustomFieldManager().getCustomFieldObject('customfield_13000')

if (issue.isSubTask())

{

def abc456 = issue.getParentObject().getCustomFieldValue(field);

return abc456

}

return null;

5.) Display Parent Issue Custom Date field on Sub-Tasks

import com.atlassian.jira.issue.Issue;

import com.atlassian.jira.ComponentManager;

import com.atlassian.jira.issue.CustomFieldManager;

import com.atlassian.jira.issue.fields.CustomField;

import com.atlassian.jira.component.ComponentAccessor;

field = ComponentAccessor.getCustomFieldManager().getCustomFieldObject('customfield_11401')

if (issue.isSubTask())

{

def abc456 = issue.getParentObject().getCustomFieldValue(field);

return abc456

}

return null;

I haven't deleted any users used in the configuration.

Here are the scripted fields setup -

1.) Display Parent Issue Attachments on Sub-tasks

2.) Read and Display User Properties on Main Issues

3.) Display Previous Issue Key Number

4.) Display Parent Issue Custom Numeric Field on Sub-tasks

5.) Display Parent Issue Custom Date field on Sub-Tasks

And here is the code for each -

1) Display Parent Issue Attachments on Sub-tasks

import com.atlassian.jira.issue.attachment.Attachment;

import com.atlassian.jira.issue.Issue;

import com.atlassian.jira.ComponentManager;

String s = "";

if(null != issue.parentObject)

{

for(Attachment att : issue.parentObject.attachments)

{

s = s +"<a href=\"" + ComponentManager.getInstance().getApplicationProperties().getString("jira.baseurl")+

"/secure/attachment/"+att.id+"/"+att.filename+"\">"+att.filename+"</a>" + "<br>";

}

}

return s;

2.) Read and Display User Properties on Main Issues

import com.atlassian.jira.user.ApplicationUsers;

import com.atlassian.crowd.embedded.api.User;

import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.user.UserPropertyManager;

UserPropertyManager userPropertyManager = ComponentAccessor.getUserPropertyManager();

String propKey = "public Location";

String propValue = null;

def u = getCustomFieldValue('Customer')

if (u) {

def dirUser = ApplicationUsers.toDirectoryUser(u)

propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);

}

return propValue;

For the second field (Read and Display User Properties on Main Issues)

replace

propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);

with

if (null != dirUser)
    propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);

and try to reindex again

if that didn't help:

try {
   propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);
} catch (Exception e) {
 //ignore nullpointer
}

I tried both methods and neither worked

0 vote

As Alexey said, it looks like the problem is that a user has been renamed.

What version of the plugin are you using?

I am using groovyrunner-3.0.3

It needs to have better error messages than that, I'll look into it.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,308 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot