Hugo build fails without clearing cache

Thank you @fool.

It leads to an interesting direction.

The article points out the silver lining behind below 3:

  1. either the tag in the submodule was never pushed
    Submodule or superproject doesn’t have any tag.
  2. or (since it is working from other sources) XXX does not have access to the submodule - private dependencies
    We saw that netlify already access to the private repo.
  3. or it has some cached version of that submodule
    Yes, it seems this is our cause. After “Clear cache and deploy” build works.

I don’t mind and can use auto clear cache solution. However I tried below one before opening this topic, but it doesn’t clear the cache`.

For instance you can look at this deploy:- 6037e159e814fd1a435f6edd. Deploy 6037e2390b77810008db2ecd failed after it.

And if I use sudo it gives below error:

5:15:06 PM: ────────────────────────────────────────────────────────────────
5:15:06 PM:   "build.command" failed                                        
5:15:06 PM: ────────────────────────────────────────────────────────────────
5:15:06 PM: ​
5:15:06 PM:   Error message
5:15:06 PM:   Command failed with exit code 127: hugo --minify && sudo rm -rf $NETLIFY_CACHE_DIR/*
​
  Error location
  In build.command from netlify.toml:
  hugo --minify && sudo rm -rf $NETLIFY_CACHE_DIR/*
​
  Resolved config
5:15:06 PM:   build:
5:15:06 PM:     command: hugo --minify && sudo rm -rf $NETLIFY_CACHE_DIR/*
    commandOrigin: config
    environment:
      - HUGO_VERSION
    publish: /opt/build/repo/public
Caching artifacts

deploy ID : 601d52bf5610f900ea4b188a