No tag attached to job

Replace this template with your information

Describe your question in as much detail as possible:

In my local gitlab installation (13.2), sometimes the jobs are waiting for a runner.
The problem is that the CI did not attach tags to the job. Once I manually attach a tag, the job is run.
I don’t know where to start looking, because sometimes the tags are assigned and sometimes no.

stages:
  - build_api_staging
  - build_api_prod

variables:
  KUBECONFIG: /config/.kube/config
  GIT_SUBMODULE_STRATEGY: recursive
  STAGING_NAMESPACE: comp-data
  TESTING_NAMESPACE: comp-testing
  PREVIEW_NAMESPACE: comp-preview
  DOCKER_TLS_CERTDIR: ""

build_api_staging:
  only:
    - develop
  before_script:
    - apk add git
    - git submodule update --recursive --remote
    - git submodule foreach git checkout develop
  script:
    - export DOCKER_HOST="tcp://localhost:2375"
    - echo "Building -DEVELOP-"
    - docker login -u "gitlab-ci-token" -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
    - docker build -f Dockerfile.api -t ${CI_REGISTRY}/${CI_PROJECT_PATH}/api:staging .
    - echo "building -STAGING-"
    - docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/api:staging
  services:
    - docker:19.03.0-dind
  stage: build_api_staging
  tags:
    - dev

build_api_prod:
  only:
    - tags
  before_script:
    - apk add git
    - git submodule update --recursive --remote
    - git submodule foreach git checkout develop
  script:
    - export DOCKER_HOST="tcp://localhost:2375"
    - echo "Building -PROD API-"
    - docker login -u "gitlab-ci-token" -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
    - docker build -t ${CI_REGISTRY}/${CI_PROJECT_PATH}/api:${CI_COMMIT_REF_NAME} . -f Dockerfile.api
    - echo "Pushing version " ${CI_COMMIT_REF_NAME}
    - docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/api:${CI_COMMIT_REF_NAME}
  services:
    - docker:19.03.0-dind
  stage: build_api_prod
  tags:
    - prod