Gitlab-ci runner fails to extract cache

Hi,

Pipeline fails due to cache issue:

Checking cache for master-1...
00:01
 FATAL: file does not exist                         
 Failed to extract cache

ci config

cache: //global
  key: "$CI_BUILD_REF_NAME"
  untracked: true
  paths:
    - client/node_modules/

I’m aware that cache might not be present in some cases, but how to prevent pipeline from failing when there isn’t one? I mean, if cache is present - use it, if not go without it. Unless it’s different issue that I’m not aware of :confused: How to deal with this?

Maybe try setting up a scheduled job to update the cache, run it manually first, then run the other jobs?

For example:

stages:
  - cache
  - build

cache:
  policy: pull
  key: ${CI_BUILD_REF_NAME}
  paths:
    - client/node_modules/

# Runs on schedule to update the cache for other jobs
update cache:
  stage: cache
  only:
    - schedules
  script:
    - npm install
  cache:
    policy: push
    key: ${CI_BUILD_REF_NAME}
    paths:
      - client/node_modules/

build website:
  stage: build
  except:
    - schedules
  script:
    - npm install
    - mybuildcommand