{"record":{"id":"f93fc5036e3a4fb1","repo":"zeroclaw-labs/zeroclaw","slug":"jira-create-ticket-failed-status","errorCode":null,"errorMessage":"Jira create_ticket failed ({status}): {}","messagePattern":"Jira create_ticket failed \\((.+?)\\): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/jira_tool.rs","lineNumber":912,"sourceCode":"            .http\n            .post(&url)\n            .json(&body)\n            .timeout(std::time::Duration::from_secs(self.timeout_secs));\n        let resp = self.authenticated(req).send().await.map_err(|e| {\n            ::zeroclaw_log::record!(\n                ERROR,\n                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)\n                    .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                    .with_attrs(::serde_json::json!({\"error\": format!(\"{}\", e)})),\n                \"jira: Jira create_ticket request failed\"\n            );\n            anyhow::Error::msg(format!(\"Jira create_ticket request failed: {e}\"))\n        })?;\n\n        let status = resp.status();\n        if !status.is_success() {\n            let text = resp.text().await.unwrap_or_default();\n            anyhow::bail!(\n                \"Jira create_ticket failed ({status}): {}\",\n                crate::util_helpers::truncate_with_ellipsis(&text, MAX_ERROR_BODY_CHARS)\n            );\n        }\n\n        let raw: Value = resp.json().await.map_err(|e| {\n            ::zeroclaw_log::record!(\n                ERROR,\n                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)\n                    .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                    .with_attrs(::serde_json::json!({\"error\": format!(\"{}\", e)})),\n                \"jira: Failed to parse Jira create_ticket response\"\n            );\n            anyhow::Error::msg(format!(\"Failed to parse Jira create_ticket response: {e}\"))\n        })?;\n\n        let key = raw[\"key\"].as_str().unwrap_or(\"\");\n        let output = json!({","sourceCodeStart":894,"sourceCodeEnd":930,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/jira_tool.rs#L894-L930","documentation":"Thrown when POST to Jira's issue-creation endpoint returns a non-2xx status. By this point project key, summary, issue type, and parent key all passed local validation, so the failure comes from Jira itself: the response body (truncated) carries Jira's error messages about fields, types, or permissions. Creation errors are almost always 400 with field-level details.","triggerScenarios":"issue_type name that does not exist in the project (400 'Could not find valid 'id'' or 'issue type is required'); parent_key given for a non-hierarchy-enabled type or non-Epic parent; a required custom field in the project's create screen; sub-task type without parent; assignee the user cannot assign (403); project key visible but create permission missing (400/403).","commonSituations":"Scripts assuming every project has Story/Bug when the project only allows Task; Jira Cloud company-managed projects with mandatory custom fields; using an issue type from a different workflow scheme; tokens whose owner lacks 'Create Issues' permission; API version 3 vs 2 differences on description format.","solutions":["Read the Jira error body in the message — it names the exact invalid field or permission.","Confirm the issue_type exists in that specific project (check the project's issue types in Jira UI).","If a parent_key is supplied, ensure the type supports hierarchy (e.g. sub-task under story, story under epic in team-managed/advanced roadmaps).","Fill required custom fields via a direct REST call if the project mandates them, or ask the admin to make them optional.","Verify the token owner has Create Issues permission on the project."],"exampleFix":"// before\njira.create_ticket(\"PROJ\", \"Epic\", \"Migrate storage\", None, None, None, Some(\"PROJ-42\")).await?; // Epic cannot have parent -> 400\n\n// after\n// epics are top-level; drop the parent, or use a child type\njira.create_ticket(\"PROJ\", \"Story\", \"Migrate storage\", None, None, None, Some(\"PROJ-42\")).await?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match jira.create_ticket(\"PROJ\", it, summary, None, None, None, parent).await {\n    Ok(res) => Ok(res),\n    Err(e) if e.to_string().contains(\"(400\") => {\n        // Jira named the bad field in the body; surface it for field mapping fixes\n        Err(e).context(\"ticket create rejected; check issue type / required fields\")\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Smoke-test create_ticket per project at deploy time (one throwaway ticket in a sandbox) to catch schema drift early.","Keep a per-project config of valid issue types and hierarchy rules (which types accept parents).","Ensure the token owner has Create Issues permission before shipping automation."],"tags":["jira","http-status","create-ticket","issue-type"],"backgroundTag":"http-error-response","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}