opf/openproject · error · RuntimeError

You are trying to import a project with an already used iden

Error message

You are trying to import a project with an already used identifier: %{taken_identifier}. Please update the project identifier in Jira then click on Retry.

What it means

While mapping a Jira project to a new OpenProject project, JiraImportProjectsJob checks the creation ServiceResult for an ActiveModel error with attribute=:identifier and type=:taken. If present it raises the localized admin.jira.run.project_identifier_taken message so the run stops and the admin is told to rename in Jira and press Retry. OpenProject derives the project identifier from the Jira project key, and identifiers are globally unique.

Source

Thrown at app/workers/import/jira_import_projects_job.rb:134

                         templated: false,
                         workspace_type: "project"
                       )
      if service_call.success?
        project = service_call.result
        insert_data = project_keys.map do |key|
          { sluggable_id: project.id,
            sluggable_type: project.class.to_s,
            slug: key,
            scope: nil }
        end
        FriendlyId::Slug.insert_all(insert_data, unique_by: %i[slug sluggable_type scope]) if insert_data.present?
        create_reference!(op_leg: project, jira_leg: jira_project, jira_import: @jira_import, uses_existing: false)
        return project
      end

      if (error = service_call.errors.find { |e| e.attribute == :identifier && e.type == :taken }) && error.present?
        taken_identifier = error.options[:value]
        raise I18n.t(:"admin.jira.run.project_identifier_taken", taken_identifier:)
      end

      raise service_call.message
    end

    def import_issue(jira_issue, project, custom_field_registry)
      type = import_type(jira_issue, project)
      status = import_status(jira_issue)
      update_workflows(type)
      new_custom_fields = new_custom_fields_in_type(jira_issue, type, custom_field_registry)
      update_custom_fields_in_type(type, new_custom_fields) if new_custom_fields.any?
      priority = import_priority(jira_issue) || IssuePriority.default || IssuePriority.active.first
      raise "Create a priority. OpenProject work package requires a priority!" if priority.blank?

      import_work_package(jira_issue, project, type, status, priority, custom_field_registry)
    end

    def new_custom_fields_in_type(jira_issue, type, custom_field_registry)

View on GitHub (pinned to d9742c43f3)

Solutions

  1. As the message says: rename the conflicting project's key in Jira, then click Retry in the import wizard.
  2. Alternatively rename or archive the conflicting OpenProject project so its identifier frees up (check FriendlyId slugs in the friendly_id_slugs table for leftovers).
  3. If the collision comes from a previous half-finished import, use the wizard's revert flow for that run before re-importing.

Example fix

# before
# attempt import, rely on late failure
service_call = Projects::CreateService.new(user: @system_user).call(**project_params)

# after (pre-check before the run starts)
if project_params[:identifier].present? && Project.exists?(identifier: project_params[:identifier])
  raise I18n.t(:'admin.jira.run.project_identifier_taken', taken_identifier: project_params[:identifier])
end
Defensive patterns

Strategy: validation

Validate before calling

key = jira_project.key.downcase
if Project.exists?(identifier: key) || FriendlyId::Slug.exists?(slug: key, sluggable_type: 'Project')
  report_collision(key)
end

Try / catch

begin
  import_projects
rescue StandardError => e
  if e.message.include?(I18n.t(:'admin.jira.run.project_identifier_taken', taken_identifier: ''))
    render_retry_dialog(identifier_collision: true)
  else
    raise
  end
end

Prevention

When it happens

Trigger: Running a Jira import that includes a project whose key collides with an existing OpenProject project identifier — typically a previous partially-completed import, a manually created project with the same identifier, or leftover FriendlyId slugs from an aborted run.

Common situations: Re-running an import after a failure where some projects were already created; someone created a project named after a Jira key while evaluating; a deleted project's slug rows still occupy the identifier.

Related errors


AI-assisted analysis of opf/openproject@d9742c43f3 (2026-08-21). Data as JSON: /api/errors/127f944d7075a5ed. Report an issue: GitHub.