No enum constant com.atlassian.jira.rest.client.api.domain.StandardOperation.COPY

lostpradise December 16, 2022

Error com.atlassian.jira.rest.client.api.domain.StandardOperation.COPY appeared without any changes in integration. What it can be?

3 answers

0 votes
Bishal Pandit December 23, 2022

Has anyone found a workaround for this?

0 votes
Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 16, 2022

Hi @lostpradise 

Where are you getting this error? After what actions?

Ree December 18, 2022

Hello @Tom Lister .

I happen to experience the same issue. In my case, I'm trying to get the issue types of a certain project and in order to do that, I have to get its metadata. The error occurs in the last line:

private CimProject getCimProject(IssueRestClient issuesClient, String projectKey) {
GetCreateIssueMetadataOptions options = new GetCreateIssueMetadataOptionsBuilder()
.withProjectKeys(projectKey)
.withExpandedIssueTypesFields().build();

Iterable<CimProject> metadata = issuesClient.getCreateIssueMetadata(options).claim();

 Any help is greatly appreciated.

Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2022

Hi @lostpradise , @Ree 

The COPY enum doesn't seem to be in the API I searched

Screenshot 2022-12-19 at 10.51.28.png

https://docs.atlassian.com/jira-rest-java-client-parent/5.0.2/apidocs/com/atlassian/jira/rest/client/api/domain/StandardOperation.html

So my best guess is that there is a mismatch between the REST API library and Jira library versions.
Sorry I can't be much more help on this.

Bitxenio S_L_ December 19, 2022

Hi

I got the same error, and begin to fail on the same date, 16 december 2022 about 20:30 hours.

We don't change any on a producction system.

I'm very lost, and support do not help us about it.

At this moment I found:

If I use an administrator user (mail & toke) the method works fine. So I think may be an authoritation problem.

The method who fail for me is:

Iterable<CimProject> metadataProjects = restClient.getIssueClient().getCreateIssueMetadata(new GetCreateIssueMetadataOptionsBuilder().withProjectKeys(projectKey).withExpandedIssueTypesFields().build()).claim();

I need the method work with the correct user and no with an administrator user, but I do not found where grant the privilegies to that user, because the administrator user fail on create the issue.

Regards

Bitxenio S_L_ December 19, 2022

I found the reason to only fails whit a user.

When the api parse the fields from the issue, whit one user do not get any fields, then the methon has no  any to parse, but whit the another user, the method fails when parse the json.

If you see the Json response

{"type":"array","items":"attachment","system":"attachment"},"name":"Adjunto","key":"attachment","hasDefaultValue":false,"operations":["set","copy"]},"customfield_10009":{"required":false,"schema":

 

has an operations

"operations":["set","copy"]}

the operation copy es the operation that is not on the enum.

 

On the souce code of package com.atlassian.jira.rest.client.api.domain;

there is no enum COPY only have the SET, ADD, REMOVE, EDIT

 

 

package com.atlassian.jira.rest.client.api.domain;

/**
* Standard Operations
*
* @since v1.0
*/
public enum StandardOperation {
SET, ADD, REMOVE, EDIT
}

Like Ree likes this
Ben Kelley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 19, 2022

Note that the above linked page https://docs.atlassian.com/jira-rest-java-client-parent/5.0.2/ refers to the REST Client for Jira Server version 5.0.2. Just checking if you're trying to talk to a Jira Cloud or Jira Server instance (as this question is tagged with jira-cloud). The APIs are different between Server and Cloud.

Ree December 19, 2022

In my organization, we're using Jira Cloud. We've always had a batch job that automatically creates new Jira tickets on our boards when certain conditions are met. For a very long time, we never updated the part of the code that creates the Jira tickets automatically but on December 16 until now, the job suddenly keeps on failing with an error message stated on this post.

Ben Kelley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 19, 2022

It's a bit hard to tell what is happening. It sounds like you're saying that you have been using the Jira Server REST client successfully against Jira Cloud (even though the APIs are in general not compatible).

I'm not quite clear which Cloud API the above code calls (and hence where the new enum type is appearing).

lostpradise December 19, 2022

We are using com.atlassian.jira:jira-rest-java-client-core:5.2.1 dependencies and it work fine until 16 dec the same as with @Ree  and @Bitxenio S_L_ . Do we need to update dependency? 

lostpradise December 19, 2022

The response code is 409 Conflict and it work fine for a long time without changes. Probably some changes in Jira cloud was released 16 december which broke integration.

Bitxenio S_L_ December 20, 2022

Exactly, we also use Jira Cloud, and we haven't made any changes in our application, started failing on December 16 about 20:30.
I think that they have changed something on the Jira Cloud side that causes the failure and I really can't think of what to do. I didn't find any new versión from jar.

Regards

Ben Kelley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 20, 2022

The Jira Server REST client that you're using is not designed to work with Jira Cloud. It's good that it previously worked for you, but I can't really suggest a fix for this problem in terms of the Jira Server REST client code. New versions of the Jira Server client ship that match the released versions of Jira Server/DC. Jira Server 5.2 shipped in 2012 (10 years ago now). A lot has changed since then.

I can't think of a simple fix (unfortunately), but I can think of a few that are not simple.

While there is no supported pre-built client library for Jira Cloud, it's possible to generate one from our published Open API (Swagger) spec using a tool like swagger-codegen. This won't be compatible with the Jira Server client at a code level though, so it will require changes to your code.

Possibly you might find a 3rd party client that is similar to the Jira Server client, but has changes to make it work better with Jira Cloud, or possibly you can make such changes yourself. This would only be a short term fix though, as Cloud APIs do change over time.

Like # people like this
Bitxenio S_L_ December 21, 2022

Thanks Ben

 

I try to generate a new client based on swagger.

 

 

Best Regards

lostpradise December 23, 2022

@Bitxenio S_L_ @Ree Did you resolve this issue?

I saw that https://mvnrepository.com/artifact/com.atlassian.jira/jira-rest-java-client-core?repo=atlassian-packages-external library make the same api call like in this Open API Specification 

Also upgrade jira-rest-java-client-core library to latest 5.2.4 but it didn't help.

Regards

Kandy Otero December 23, 2022

Hi, 

at the moment I didn't resolve definitely the issue. We need to develop a new client from scratch.

We prepare a temporal solution hardcoding the data (issuetype id, and some custom fields ids) on the source.

For the momento we didn't change the templates, so the id will not change.

 

Regards

Like lostpradise likes this

Suggest an answer

Log in or Sign up to answer