{"record":{"id":"127f944d7075a5ed","repo":"opf/openproject","slug":"you-are-trying-to-import-a-project-with-an-already","errorCode":null,"errorMessage":"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.","messagePattern":"You are trying to import a project with an already used identifier: %(.+?)\\. Please update the project identifier in Jira then click on Retry\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/workers/import/jira_import_projects_job.rb","lineNumber":134,"sourceCode":"                         templated: false,\n                         workspace_type: \"project\"\n                       )\n      if service_call.success?\n        project = service_call.result\n        insert_data = project_keys.map do |key|\n          { sluggable_id: project.id,\n            sluggable_type: project.class.to_s,\n            slug: key,\n            scope: nil }\n        end\n        FriendlyId::Slug.insert_all(insert_data, unique_by: %i[slug sluggable_type scope]) if insert_data.present?\n        create_reference!(op_leg: project, jira_leg: jira_project, jira_import: @jira_import, uses_existing: false)\n        return project\n      end\n\n      if (error = service_call.errors.find { |e| e.attribute == :identifier && e.type == :taken }) && error.present?\n        taken_identifier = error.options[:value]\n        raise I18n.t(:\"admin.jira.run.project_identifier_taken\", taken_identifier:)\n      end\n\n      raise service_call.message\n    end\n\n    def import_issue(jira_issue, project, custom_field_registry)\n      type = import_type(jira_issue, project)\n      status = import_status(jira_issue)\n      update_workflows(type)\n      new_custom_fields = new_custom_fields_in_type(jira_issue, type, custom_field_registry)\n      update_custom_fields_in_type(type, new_custom_fields) if new_custom_fields.any?\n      priority = import_priority(jira_issue) || IssuePriority.default || IssuePriority.active.first\n      raise \"Create a priority. OpenProject work package requires a priority!\" if priority.blank?\n\n      import_work_package(jira_issue, project, type, status, priority, custom_field_registry)\n    end\n\n    def new_custom_fields_in_type(jira_issue, type, custom_field_registry)","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/opf/openproject/blob/d9742c43f3424c34b63550f8c03f201fe5c3040c/app/workers/import/jira_import_projects_job.rb#L116-L152","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["As the message says: rename the conflicting project's key in Jira, then click Retry in the import wizard.","Alternatively rename or archive the conflicting OpenProject project so its identifier frees up (check FriendlyId slugs in the friendly_id_slugs table for leftovers).","If the collision comes from a previous half-finished import, use the wizard's revert flow for that run before re-importing."],"exampleFix":"# before\n# attempt import, rely on late failure\nservice_call = Projects::CreateService.new(user: @system_user).call(**project_params)\n\n# after (pre-check before the run starts)\nif project_params[:identifier].present? && Project.exists?(identifier: project_params[:identifier])\n  raise I18n.t(:'admin.jira.run.project_identifier_taken', taken_identifier: project_params[:identifier])\nend","handlingStrategy":"validation","validationCode":"key = jira_project.key.downcase\nif Project.exists?(identifier: key) || FriendlyId::Slug.exists?(slug: key, sluggable_type: 'Project')\n  report_collision(key)\nend","typeGuard":null,"tryCatchPattern":"begin\n  import_projects\nrescue StandardError => e\n  if e.message.include?(I18n.t(:'admin.jira.run.project_identifier_taken', taken_identifier: ''))\n    render_retry_dialog(identifier_collision: true)\n  else\n    raise\n  end\nend","preventionTips":["Pre-flight the import: list Jira project keys, check each against Project identifiers and friendly_id_slugs, resolve collisions before the run.","Revert failed runs completely (the wizard's revert flow) before re-importing the same Jira projects.","Document that Jira project keys become OpenProject identifiers, so teams avoid creating projects with those identifiers."],"tags":["jira-import","project-identifier","uniqueness","import-mapping"],"backgroundTag":"duplicate-identifier","analyzedSha":"d9742c43f3424c34b63550f8c03f201fe5c3040c","analyzedAt":"2026-08-21T14:40:06.829Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}