Cannot create a new issue when the "description" field is not a valid field
Describe the bug
When creating a new issue the "description" field is not always a valid field, but it is always being set. In my case the description field has been removed from the "Task" type and replaced with a custom field, but when running the command jira issue create the description field is always set and this error is printed:
- description: Field 'description' cannot be set. It is not on the appropriate screen, or unknown.
- JiraCLI Version:
(Version="v1.5.2", GitCommit="", CommitDate="", GoVersion="go1.22.6", Compiler="gc", Platform="darwin/arm64")
- Are you using Jira cloud or on-premise jira server?
SERVER INFO
-----------
Version: 1001.0.0-SNAPSHOT
Build Number: 100278
Deployment Type: Cloud
Default Locale: en_US
- What operating system are you using? Also mention version.
macOS Sonoma 14.7.3
- What terminal are you using? Also mention version.
iTerm 2 Build 3.5.11
To Reproduce
Steps to reproduce the behavior:
jira create issue --type=Task
On my companies installation, when querying the createmeta for this issue Task, the description field is not present.
Expected behavior
One should be able to create a new jira issue. Either the CLI needs to fetch the createmeta to see that the description field should not be defaulted or another flag needs to be added to disable auto setting this field.
I'm also running into the same issue. Very similar setup except on Sequoia (but I don't believe this is relevant). It happens for any issue time I try to create.
SERVER INFO
-----------
Version: 1001.0.0-SNAPSHOT
Build Number: 100283
Deployment Type: Cloud
Default Locale: en_US
I can execute other commands successfully (for example listing projects or issues).
Same here.
This issue is not related to jira-cli as I have the same error using curl
'{
"fields": {
"project": {
"key": "DEMO"
},
"summary": "Demo ticket",
"description": "demo demo"
"issuetype": {
"name": "Task"
}
}
}'
{"errorMessages":[],"errors":{"description":"Field 'description' cannot be set. It is not on the appropriate screen, or unknown."}}
Removing the field description makes curl ok... So I suppose that the problem is jira-cli is sending the description field with empty value, which is not accepted by the jira server. (config?)
PS: Dirty fix : You can disable the Body field:
--- a/internal/cmd/issue/create/create.go
+++ b/internal/cmd/issue/create/create.go
@@ -109,11 +109,12 @@ func create(cmd *cobra.Command, _ []string) {
defer s.Stop()
cr := jira.CreateRequest{
- Project: project,
- IssueType: params.IssueType,
- ParentIssueKey: params.ParentIssueKey,
- Summary: params.Summary,
- Body: params.Body,
+ Project: project,
+ IssueType: params.IssueType,
+ ParentIssueKey: params.ParentIssueKey,
+ Summary: params.Summary,
+ // Body need to be null in my org
+ //Body: params.Body,
Reporter: params.Reporter,
Assignee: params.Assignee,
Priority: params.Priority,
And provide the proper custom field to fill the description.
Yes, you could fix this by directly removing body which will lead to it not being included in the request fields, but I imagine the right way would be to:
- determine what fields are valid/invalid and maybe store this in the configuration. Not sure if this is possible
- if
descriptionis a valid field then probably defaulting to the empty string is correct if it isn't specified. Otherwise it shouldn't be included.