Jira "Field ... cannot be set" (wrong customfield id) in CI
Custom field ids like customfield_10021 are assigned per Jira site and are not portable. Using an id that is not on the screen, or copied from another instance, yields "Field cannot be set" or "does not exist."
What this error means
An issue create/update fails with 400 and "customfield_10021":"Field 'customfield_10021' cannot be set. It is not on the appropriate screen, or unknown."
HTTP/1.1 400 Bad Request
{"errorMessages":[],"errors":{"customfield_10021":
"Field 'customfield_10021' cannot be set. It is not on the appropriate screen, or unknown."}}Common causes
The custom field id differs from another site
Jira assigns customfield ids sequentially per instance, so a story-points id in one site rarely matches another. Copied ids break.
The field is not on the create/edit screen
Even a correct id fails if the field is not associated with the screen for that project and issue type.
How to fix it
Look up the field id by name
- List all fields and grep for the custom field by its display name.
- Use the id returned for this site, not one hardcoded from elsewhere.
- Confirm the field is on the screen via createmeta before setting it.
curl -sf -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
"https://your-domain.atlassian.net/rest/api/3/field" | \
jq '.[] | select(.name=="Story Points") | .id'Add the field to the screen
If the id is right but not on the screen, add the field to the project screen for that issue type, or use a config that includes it.
How to prevent it
- Resolve customfield ids by name at runtime, never hardcode across sites.
- Validate with createmeta that the field is on the target screen.
- Keep a per-site mapping if you deploy to multiple Jira instances.