Skip to content

Older versions of JIRA may not have this "key" field #99

Description

@csprance

self._jira_fields_map[jira_field["key"].lower()] = jira_field["id"]

Older versions of JIRA server don't seem to always have this key field here. I ended up just throwing a defensive gate around it to check it if

I just did

            # Some fields might not have a 'key' attribute, so check first
            if "key" in jira_field:
                self._jira_fields_map[jira_field["key"].lower()] = jira_field["id"]
            else:
                # For fields without 'key', try alternative identifiers
                # Use the field ID as a fallback key (common for custom fields)
                fallback_key = jira_field["id"].lower()
                self._jira_fields_map[fallback_key] = jira_field["id"]

                # Also try using sanitized name as key (remove spaces, special chars)
                sanitized_name = (
                    jira_field["name"].lower().replace(" ", "_").replace("-", "_")
                )
                self._jira_fields_map[sanitized_name] = jira_field["id"]

                # logger.debug(f"JIRA field missing 'key' attribute, using fallbacks - ID: {fallback_key}, Name: {sanitized_name}, Original: {jira_field}")

Otherwise the JIRA bridge won't even start since it tries to do some setup when it first starts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions