Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Error message "gh.epic.error.not.found" using Atlassian.SDK 11.2.0 to link an issue to an epic

Victor Ho
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 23, 2020

I am trying to use Atlassian.SDK 11.2.0 to link an issue to an epic, with the following link of code:

issue.CustomFields.Add("Epic Link", "MyEpic01");

where "Epic Link" is my field name, and "MyEpic01" is the epic I want to link my issue to.

However, when I run my program, I have an run-time error as below:

InvalidOperationException: Response Status Code: 400. Response Content: {errorMessage":["gh.epic.error.not.found"],"errors":[]}

However, I do not this problem if I create an issue and link it to the epic manually in the JIRA interface,

I saw another post that mentioned something that I need "Greenhopper" API.

https://community.atlassian.com/t5/Jira-questions/Can-we-edit-EPIC-Link-as-a-customfield-13386-using-jira-rest-api/qaq-p/1128908

However, I am not quite familiar with Greenhopper API and need more information on this. Or, is it possible to make my code work without Greenhopper?

Thanks for your help.

 

1 answer

0 votes
Victor Ho
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 15, 2020

My problem has been solved. Below is what I did:

In order to link an issue to an epic, the following conditions must be met:

1. The epic must already exist.
2. The issue that will be linked to that epic should have been created.

Then, the program can execute this line of code:

issue.CustomFields.Add("Epic Link", epicKey);

Where epicKey is the ticket number (or issue key) of the epic you want to link. Note that it is the issue key that is to be linked, not epic name. 

Say, we have an epic name "MyEpic01", which itself is an issue, and its issue key is "Project-135". When doing the Epic Link, we are linking the issue to that epic using its ticket number as the identifier.

Therefore, if we were to hard-code the Epic Link, that is what to write:

issue.CustomFields.Add("Epic Link", "Project-135"); 

After the Epic Link is done, don’t forget to save our work, as below:

issue = await issue.SaveChangesAsync();

Now the code to link a Jira ticket to its corresponding Epic should work.

By the way, the error message is a bit odd, but it actually means the epic cannot be found. The error has nothing to do with Greenhopper.

Marc Isikoff
Contributor
June 21, 2024

I am getting this error in automating the Epic Link.

I setup a manual automation to test this and used it on an issue that already has an Epic Link to test if it will successfully set the Epic link to the Epic that it had. This way I know the Epic does exist.

Prior to automation I can test in JQL with project = "my epics project" and issuetype = epic and summary ~ "123456" which gives me one row, one epic.

In automation I then create a variable (epicKey) as project = "my project" and issutype = epic and summary ~ {{issue.customfield_#####}}. Since I am using smart values Jira cannot validate the JQL (standard functionality).

Now when I set Epic Link to {{epicKey}} it raises the error suggesting the Epic is not found. Since I know it exists it must be something wrong with the variable epicKey definition.

Any help would be appreciated.

Suggest an answer

Log in or Sign up to answer