← Back to issue list

Flutter plugin breaks during precache

View original Github issue

Metadata

Project
snapcraft
Number
#5258
Type
issue
State
closed
Author
bepri
Labels
β€”
Created
Updated
Closed

Current evaluation

Fixed by merged PR canonical/snapcraft#5264 (commit acf0ce744), correcting Flutter precache Git branch references. Released in Snapcraft 8.6.3 and 8.7.1.

Resolution: closed resolved

Reason: PR #5264 merged commit acf0ce744 with Flutter's workaround for the missing origin/master reference. Maintainers confirmed the fix shipped in Snapcraft 8.6.3 and 8.7.1.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description Currently, the Flutter plugin installs Flutter using an undocumented git-based method, which breaks due to what appear to be some internal forks to `git` in Flutter: ``` :: + flutter precache --linux :: Woah! You appear to be trying to run flutter as root. :: We strongly recommend running the flutter tool without superuser privileges. :: / :: πŸ“Ž :: fatal: Not a valid object name origin/master ``` (note the last line especially) The issue here is that we clone with `-b stable`, which means only the `stable` branch is present locally. Cloning the `master` branch instead gets us further, but still fails due to what appears to be the Flutter repository using a placeholder "0.0.0" version in that branch. However, there _is_ a Flutter snap, which does not appear to have any of these troubles. We could, alternatively, rename the local remote `stable` to `master` as a workaround. ### To Reproduce Attempt to build anything with the Flutter plugin ### Environment Any version of Snapcraft ### snapcraft.yaml ```yaml name: flutter-hello version: "1.0" summary: simple flutter application description: build a flutter application using core22 base: core22 confinement: strict apps: flutter-hello: command: "flutter_hello" extensions: [gnome] parts: hello: source: . plugin: flutter ``` ### Relevant log output ```shell :: + flutter precache --linux :: Woah! You appear to be trying to run flutter as root. :: We strongly recommend running the flutter tool without superuser privileges. :: / :: πŸ“Ž :: fatal: Not a valid object name origin/master ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha β€” closed resolved Fixed by merged PR canonical/snapcraft#5264 (commit acf0ce744), correcting Flutter precache Git branch references. Released in Snapcraft 8.6.3 and 8.7.1.
stealth/space-bunny-alpha β€” closed resolved Fixed the precache Git branch-reference failure by applying Flutter’s suggested workaround in canonical/snapcraft#5264; released in Snapcraft 8.6.3 and 8.7.1.
qwen/qwen3.6-35b-a3b β€” β€” Fixed in Snapcraft 8.6.3 and 8.7.1. The Flutter plugin precache failure caused by git branch reference errors was resolved. Users not using the plugin must apply a manual workaround or wait for an upstream Flutter release.
qwen/qwen3.6-35b-a3b β€” β€” Fixed in Snapcraft 8.6.3 and 8.7.1. Maintainers patched the Flutter plugin to resolve the git branch precache failure. Projects using custom flutter-git parts must apply the same workaround or await an upstream Flutter release.
qwen3.6-35b-a3b-mtp-q6 β€” β€” Fixed in Snapcraft 8.6.3 and 8.7.1. The Flutter plugin precache git branch error was resolved by updating the installation method. Users bypassing the plugin must apply a manual workaround or wait for an upstream Flutter release.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#5264 (confidence 100%)

    Merged corrective change for the Flutter plugin's Git errors.

  • Related To: flutter#163198 (confidence 98%)

    Upstream Flutter issue identified as the cause of the precache failure.

  • Related To: flutter#163308 (confidence 95%)

    Upstream discussion containing the workaround adopted by Snapcraft.

Related issues

Issue Project State Summary Similarity
#5267 fix: correct git errors in flutter plugin snapcraft merged Merged #5267, cherry-picking #5264 into the 8.6 branch to fix Flutter precache git errors; released in Snapcraft 8.6.3 and 8.7.1.
84%
#5264 fix: correct git errors in flutter plugin snapcraft merged Merged #5264 fixed Flutter plugin Git errors using Flutter's suggested workaround, closing #5258; released in Snapcraft 8.6.3 and 8.7.1.
78%