Flutter build fails if cache used and pub has custom git repository dependencies

Description of the issue


  • using default cache pull and cache push steps
  • having dependencies that are stored in git repository instead of pub.dev package repository
    e.g. pubspec.yaml has:
      url: git@bitbucket.name-team/corelibrary-flutter.git
      path: packages/logging
      ref: 838e54d

Build crashes with error:

Running "flutter pub get" in mobile...                          
Cannot open file, path = '/usr/local/flutter/.pub-cache/git/corelibrary-flutter-3c4e423ff318ca0411059e0db3bae806146cab8d/.git/pub-packages' (OS Error: No such file or directory, errno = 2)
---- Log transcript ----
FINE: Pub 2.4.0

When disabling cache the build succeeds.


Sample build that crashed second time in a row:
28c34e317c3c93b5 - https://app.bitrise.io/build/28c34e317c3c93b5#?tab=log

Visual Studio for Mac, stable

1 Like

Sorry for the delay here @dominik.roszkowski, we have created a task for the team to investigate this. Can you please enable Support Access on this app?

1 Like

Thanks, support enabled for https://app.bitrise.io/app/c47126b04acd7b26#/settings

You need to add cache steps again, because I removed them after the described incident.

The same problem can be seen here https://app.bitrise.io/build/7b78f40c91d2f8a5#?tab=log

1 Like

Again similar situation here https://app.bitrise.io/build/399355aa59025c1a#?tab=log

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Hello @dominik.roszkowski,
Started investigating this issue.
Did you recently encountered builds with this issue? It could be useful to analyze the root cause if you added the command flutter pub cache repair in a script step before flutter-build.
Could you please also share the full pubspec.yaml and the list of dependencies between your corelibrary packages (it seems there are more than on packages in the repository)?
Additionally if you can share the cache-archive state when a build failed it would be greatly useful.

Hello @dominik.roszkowski
A pre-release version of a fix for flutter-build is available. It would be a huge help if you can help trying it out.
It can be added by replacing - flutter-build with ​- git::https://github.com/bitrise-steplib/bitrise-step-flutter-build.git@fix-cache: in a bitrise.yml workflow. Recommend creating a temporary workflow for this.

Happy to report that the flutter-build step caching issue is fixed. Released a new version 0.13.0 (https://github.com/bitrise-steplib/bitrise-step-flutter-build/releases/tag/0.13.0).