ArgumentError: 3:invalid git directory: rpc error: code = NotFound desc = GetRepoPath: not a git repository '/va...

Description

As of Nov 2025, the URL Import page has been upgraded and users can now access Project settings > Repository, which fixes the original bug.

The project settings page does show an Import in progress banner saying the import is in progress

If the import failed, a project is still created but no repo is attached. If the user navigated away (to settings for example) and returns to the project page, they see an empty project but are not told why

Screenshot 2025-11-18 at 4.57.04 PM.png

However, if the user stayed in the same page while the import was processed, the user is redirected to <group>/<newprojectname>/-/import/new and are provided an error message and shown the retry form. This is correct behaviour.

It just needs to be extended to other pages under <group>/<newprojectname>/

Acceptance criteria

  • When import fails due to authentication
    • Provide clear messaging on the project page and any other page related to the project

Bug report (previous)

https://sentry.gitlab.net/gitlab/gitlabcom/issues/1148734/

GRPC::InvalidArgument: 3:invalid git directory: rpc error: code = NotFound desc = GetRepoPath: not a git repository '/var/opt/gitlab/git-data/repositories/@hashed/e4/90/e4901197b65e40689f906704b883bd08c9411e4796db698951b660f19376f246.git'
  grpc/generic/active_call.rb:31:in `check_status'
    fail GRPC::BadStatus.new_status_exception(
  grpc/generic/active_call.rb:181:in `attach_status_results_and_complete_call'
    recv_status_batch_result.check_status
  grpc/generic/active_call.rb:170:in `receive_and_check_status'
    attach_status_results_and_complete_call(batch_result)
  grpc/generic/active_call.rb:338:in `each_remote_read_then_finish'
    receive_and_check_status
  gitlab/gitaly_client/ref_service.rb:298:in `each'
    response.flat_map do |message|
...
(152 additional frame(s) were not displayed)

ArgumentError: 3:invalid git directory: rpc error: code = NotFound desc = GetRepoPath: not a git repository '/var/opt/gitlab/git-data/repositories/@hashed/e4/90/e4901197b65e40689f906704b883bd08c9411e4796db698951b660f19376f246.git'
  gitlab/git/wraps_gitaly_errors.rb:11:in `rescue in wrapped_gitaly_errors'
    raise ArgumentError.new(e)
  gitlab/git/wraps_gitaly_errors.rb:6:in `wrapped_gitaly_errors'
    def wrapped_gitaly_errors(&block)
  gitlab/metrics/instrumentation.rb:161:in `block in wrapped_gitaly_errors'
    .measure { super }
  gitlab/metrics/method_call.rb:36:in `measure'
    retval = yield
  gitlab/metrics/instrumentation.rb:161:in `wrapped_gitaly_errors'
    .measure { super }
...
(144 additional frame(s) were not displayed)

ArgumentError: 3:invalid git directory: rpc error: code = NotFound desc = GetRepoPath: not a git repository '/var/opt/gitlab/git-data/repositories/@hashed/e4/90/e4901197b65e40689f906704b883bd08c9411e4796db698951b660f19376f246.git'

Summary

When a project import fail, going to repository setting will throw 500 error. User should be able to go to repository setting and reconfigure import (there's an Import setting button in the project page but user intuitively go to repository setting so at the very least, a better error message should be display.

Step to reproduce

  1. Create a new project
  2. Go to Import project on the new project creation page
  3. Click on git Repo by URL
  4. Provide Git repository URL
  5. Provide username and possible wrong password
  6. When the import failed, go to project Settings > Repository → 500 error page

Example Project

https://gitlab.com/rotanak/test-mirror-1

What is the current bug behavior?

Going to Repository setting will throw 500 error page

What is the expected correct behavior?

Provide a meaningful error message or allow user to change the import setting.

Output of checks

Happens on GitLab.com, GitLab Enterprise Edition 12.7.0-pre fba6b21f

Edited by Oiza Baiye