Submodule checkout fails with "destination path already exists and is not an empty directory"

Submodule checkout fails with "destination path already exists and is not an empty directory"

Job definition:

build_ui:
  image: node:16-alpine
  stage: build
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  script:
    - ...
  artifacts:
    paths:
      - ui/build

Log:

Running with gitlab-runner 14.9.1 (bd40e3da)
  on AWS GitLab runner review ec4fJ9zS
Preparing the "docker+machine" executor
Using Docker executor with image node:16-alpine ...
Pulling docker image node:16-alpine ...
Using docker image sha256:5521a6fdce5cf1d57e20b234db7b54f98df2a94bed1c4895858d54f9e19ed947 for node:16-alpine with digest node@sha256:32f64135e74ec4dc5d63cc36318444f1d801cd23c44253124f7eccb52c4b89c5 ...
Preparing environment
00:00
Running on runner-ec4fj9zs-project-33174755-concurrent-0 via runner-ec4fj9zs-gitlab-runner-docker-machine-1648703805-36cf64f0...
Getting source from Git repository
00:03
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/***/.git/
Checking out edab5b7e as main...
Updating/initializing submodules with git depth set to 20...
Synchronizing submodule url for 'ui'
fatal: destination path '/builds/***/ui' already exists and is not an empty directory.
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.com/***-ui' into submodule path '/builds/***/ui' failed
Failed to clone 'ui'. Retry scheduled
fatal: destination path '/builds/***/ui' already exists and is not an empty directory.
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.com/***-ui' into submodule path '/builds/***/ui' failed
Failed to clone 'ui' a second time, aborting
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1

How to fix that?

Edited by Alex Pravdin