Hello everybody.
At several occasions in my workflows I use ScriptRunner (groovy) scripts to clone issues and link them automatically. That works fine, but now one of those scripts lost a certain preference and created a broken clone that is not accessible. If I enter the URL for that issue I get a:
Another effect is a broken link in the original issue that has been created by the script and is now only showing the following message in the linkingissues-section:
"Error rendering 'com.atlassian.jira.jira-view-issue-plugin:linkingmodule'"
Only this one issue is affected, so it's not a broken linktype, which is the hint you get if you ask google about that error.
I assume that I have to repair/delete the broken issue (with the known issue ID) in the database directly, correct? I have (only) a little experience with SQL (MS SQL in our case). Can someone please tell me what I have to do?
Can I simply delete the broken issue? And if so, how do I do that properly and not corrupt the whole db?
Will the link be repaired automatically if it points to a deleted issue? Or do I have to correct that as well? If so: how?
If you need more info, I'll gladly provide it.
Thanks a lot in advance!
Hendrik
Okay, I got it solved.
1. Try to open the issue in question and observe the atlassian-jira.log. In my case, it said that the issue had a 'issuetype' = null (and gave me the issue database ID).
2. I stopped my jira instance. (And should have made a backup *cough*)
3. updated the table dbo.jiraissue for my issue-id, set the issuetype from null to a proper one.
4. Restarted jira. Done.
Today I ran the built-in database integrity checker, but it didn't find broken links in the db. Seems it doesn't check if the target issues throw NullPointers somewhere, but only that there is "something" where the link points towards.
In this post from 22 Feb 2016, Nic suggests to avoid deleting an issue from the db if possible. Well, I'm not sure if I have that option, that clone-and-link-script seems to have messed up my issue completely.
My daily log-report via mail states 6 new (known) errors, oneof those is:
None of them has a broken issue as a symptom, but that one seems worth a try to at least repair the broken link.
If no one else has an idea how to safely delete a currupted issue, I will try the delete-in-the-db-option after checking the REST call Michael suggested.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Greetings,
you should be able to delete an issue like so (assuming you have curl installed):
curl -u yourname:s3cr3tpw -X "DELETE" http://jira.example.com/rest/api/2/issue/ABC-1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, Michael.
Thanks for the reply, but I am uncertain how to make REST calls. I only have my jira server instance and script runner installed.
But you made me think of trying to delete the issue with a groovy script, but wasn't successful. Executed via ScriptRunners "ScriptConsole".
This is my n00b-script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
def im = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
im.deleteIssue(user, im.getIssueObject('ABC-1'), EventDispatchOption.ISSUE_DELETED, false)
And I received:
2019-07-16 16:44:59,433 WARN [common.UserScriptEndpoint]: Script console script failed: java.lang.NullPointerException at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.getEpic(EpicLinkManagerImpl.java:84) at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCFType.getValueFromIssue(EpicLinkCFType.java:267) at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCFType.getValueFromIssue(EpicLinkCFType.java:44) at com.atlassian.jira.issue.fields.ImmutableCustomField.getValue(ImmutableCustomField.java:350) at com.atlassian.jira.issue.managers.DefaultIssueDeleteHelper$DeletedIssueEventData.collectCustomFieldValues(DefaultIssueDeleteHelper.java:288) at com.atlassian.jira.issue.managers.DefaultIssueDeleteHelper$DeletedIssueEventData.<init>(DefaultIssueDeleteHelper.java:275) at com.atlassian.jira.issue.managers.DefaultIssueDeleteHelper.deleteIssue(DefaultIssueDeleteHelper.java:120) at com.atlassian.jira.issue.managers.DefaultIssueManager.deleteIssue(DefaultIssueManager.java:723) at com.atlassian.jira.issue.managers.RequestCachingIssueManager.deleteIssue(RequestCachingIssueManager.java:232) at com.atlassian.jira.issue.IssueManager$deleteIssue$0.call(Unknown Source) at Script191.run(Script191.groovy:13)
Could it be that the issue can't be deleted in a simple way? Or is my script just bad? (Ok, there was a warning about deprecated code concerning retrieving the loggedInUser, but hey...)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is your jira running on a linux machine?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, our environment (which I don't account for) is on Windows Server 2012.
I over-read the part about "curl installed", sorry!
Curl is part of Win Server 2012, but didn't work so I helped myself to a copy of curl for win, which is running good. Unfortunately, it throws an internal server error if I try to DELETE my corrupted issue. I tried a test-issue that I just created and that could be deleted without problems. So it seems my issue is really messed up...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, I really have to get used to consulting log files.
If I try to open that issue, atlassian-jira.log says that the issue type of that issue is 'null', which is not a good thing. Can I try to set a valid type via REST or GROOVY, or do I have to do it via the db?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.