Import project from locally installed BitBucket Server fails - 500 Internal Server Error

I attempted to import a BitBucket project using the UI web application, but it failed without providing a specific error message, only stating “Importing the project
failed”. However, it is possible to connect with the BitBucket server and list repositories.

I tried the same process using curl, and received the following message: {"message":"500 Internal Server Error"}.

How can I fix this? Is there another way to import projects/repositories from an old BitBucket server?

Errors in log file:

{
    "time": "2024-01-23T16:33:54.910Z",
    "severity": "INFO",
    "duration_s": 0.06676,
    "db_duration_s": 0.00228,
    "view_duration_s": 0.06448,
    "status": 500,
    "method": "POST",
    "path": "/api/v4/import/bitbucket_server",
    "params": [
        {
            "key": "bitbucket_server_url",
            "value": "https://bitbucket.company.local"
        },
        {
            "key": "bitbucket_server_username",
            "value": "admin"
        },
        {
            "key": "personal_access_token",
            "value": "[FILTERED]"
        },
        {
            "key": "bitbucket_server_project",
            "value": "FCRM"
        },
        {
            "key": "bitbucket_server_repo",
            "value": "validation"
        }
    ],
    "host": "gitlab.company.local",
    "remote_ip": "10.0.0.2, 127.0.0.1",
    "ua": "curl/8.5.0",
    "route": "/api/:version/import/bitbucket_server",
    "user_id": 1,
    "username": "root",
    "token_type": "PersonalAccessToken",
    "token_id": 1,
    "exception.class": "NoMethodError",
    "exception.message": "undefined method `fetch' for nil:NilClass\n\n        raw['links']['clone'].find { |link| link['name'].starts_with?('http') }.fetch('href')\n                                                                               ^^^^^^",
    "exception.backtrace": [
        "lib/bitbucket_server/representation/repo.rb:25:in `clone_url'",
        "lib/gitlab/bitbucket_server_import/project_creator.rb:29:in `execute'",
        "app/services/import/bitbucket_server_service.rb:47:in `create_project'",
        "app/services/import/bitbucket_server_service.rb:20:in `execute'",
        "lib/api/import_bitbucket_server.rb:48:in `block in <class:ImportBitbucketServer>'",
        "ee/lib/gitlab/middleware/ip_restrictor.rb:14:in `block in call'",
        "ee/lib/gitlab/ip_address_state.rb:10:in `with'",
        "ee/lib/gitlab/middleware/ip_restrictor.rb:13:in `call'",
        "lib/api/api_guard.rb:219:in `call'",
        "lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'",
        "lib/gitlab/middleware/memory_report.rb:13:in `call'",
        "lib/gitlab/middleware/speedscope.rb:13:in `call'",
        "lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'",
        "lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'",
        "lib/gitlab/etag_caching/middleware.rb:21:in `call'",
        "lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'",
        "lib/gitlab/metrics/web_transaction.rb:46:in `run'",
        "lib/gitlab/metrics/rack_middleware.rb:16:in `call'",
        "lib/gitlab/middleware/go.rb:20:in `call'",
        "lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'",
        "lib/gitlab/database/query_analyzer.rb:37:in `within'",
        "lib/gitlab/middleware/query_analyzer.rb:11:in `call'",
        "lib/gitlab/middleware/multipart.rb:173:in `call'",
        "lib/gitlab/middleware/read_only/controller.rb:50:in `call'",
        "lib/gitlab/middleware/read_only.rb:18:in `call'",
        "lib/gitlab/middleware/unauthenticated_session_expiry.rb:18:in `call'",
        "lib/gitlab/middleware/same_site_cookies.rb:27:in `call'",
        "lib/gitlab/middleware/path_traversal_check.rb:35:in `call'",
        "lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'",
        "lib/gitlab/middleware/basic_health_check.rb:25:in `call'",
        "lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'",
        "lib/gitlab/middleware/request_context.rb:15:in `call'",
        "lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'",
        "config/initializers/fix_local_cache_middleware.rb:11:in `call'",
        "lib/gitlab/middleware/compressed_json.rb:44:in `call'",
        "lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'",
        "lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'",
        "lib/gitlab/metrics/requests_rack_middleware.rb:79:in `call'",
        "lib/gitlab/middleware/release_env.rb:13:in `call'"
    ],
    "queue_duration_s": 0.012264,
    "redis_calls": 3,
    "redis_duration_s": 0.001741,
    "redis_read_bytes": 1,
    "redis_write_bytes": 153,
    "redis_cache_calls": 1,
    "redis_cache_duration_s": 0.000299,
    "redis_cache_read_bytes": 1,
    "redis_cache_write_bytes": 47,
    "redis_shared_state_calls": 2,
    "redis_shared_state_duration_s": 0.001442,
    "redis_shared_state_write_bytes": 106,
    "db_count": 5,
    "db_write_count": 0,
    "db_cached_count": 2,
    "db_replica_count": 0,
    "db_primary_count": 5,
    "db_main_count": 5,
    "db_ci_count": 0,
    "db_main_replica_count": 0,
    "db_ci_replica_count": 0,
    "db_replica_cached_count": 0,
    "db_primary_cached_count": 2,
    "db_main_cached_count": 2,
    "db_ci_cached_count": 0,
    "db_main_replica_cached_count": 0,
    "db_ci_replica_cached_count": 0,
    "db_replica_wal_count": 0,
    "db_primary_wal_count": 0,
    "db_main_wal_count": 0,
    "db_ci_wal_count": 0,
    "db_main_replica_wal_count": 0,
    "db_ci_replica_wal_count": 0,
    "db_replica_wal_cached_count": 0,
    "db_primary_wal_cached_count": 0,
    "db_main_wal_cached_count": 0,
    "db_ci_wal_cached_count": 0,
    "db_main_replica_wal_cached_count": 0,
    "db_ci_replica_wal_cached_count": 0,
    "db_replica_duration_s": 0.0,
    "db_primary_duration_s": 0.002,
    "db_main_duration_s": 0.002,
    "db_ci_duration_s": 0.0,
    "db_main_replica_duration_s": 0.0,
    "db_ci_replica_duration_s": 0.0,
    "external_http_count": 1,
    "external_http_duration_s": 0.031108325001696358,
    "cpu_s": 0.043045,
    "mem_objects": 13863,
    "mem_bytes": 1352456,
    "mem_mallocs": 6950,
    "mem_total_bytes": 1906976,
    "pid": 9789,
    "worker_id": "puma_1",
    "rate_limiting_gates": [],
    "correlation_id": "01HMVJQM4CQWB7VP45KSH0JYG1",
    "meta.caller_id": "POST /api/:version/import/bitbucket_server",
    "meta.remote_ip": "10.0.0.2",
    "meta.feature_category": "importers",
    "meta.user": "root",
    "meta.user_id": 1,
    "meta.client_id": "user/1",
    "content_length": "264",
    "request_urgency": "low",
    "target_duration_s": 5
}