← Back to issue list

Experimental offline mode fails with network present

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1950479
Type
issue
State
open
Author
~igorljubuncic-deactivatedaccount
Labels
cache caching experimental network offline snapcraft
Created
Updated
Closed

Current evaluation

Snapcraft's experimental --offline mode crashes with 'NoneType' object is not subscriptable in snaps.py when network is present, and lacks graceful failover. Reported ~4.8 years ago with no maintainer response; the offline feature was only ever added as a warning-only experimental flag.

Suggested action: close stale

Reason: The issue is 1755 days old with zero comments, no labels, and a deactivated reporter account, and the offline feature it targets was only ever merged as a warning-only experimental flag (PR #3577: 'triggers a warning and performs no actions until offline behavior stabilizes'), while the companion implementation PR #3571 '[WIP] offline' was abandoned and closed unmerged. The code paths in the traceback (build_providers/_snap.py, repo/snaps.py) have been substantially reworked since, so the original problem is no longer reproducible in current versions.

Impact: 25 Quick Win: 11.25 Staleness: 90 Complexity: 55 Confidence: 68 Support Request: 10

Issue body

The experimental offline mode in snapcraft does not work as intended, and does not have a graceful failover. How to reproduce: Ubuntu 18.04 system (and also in some cases 20.04) Run snapcraft --offline (with lxd or multipass) on any snapcraft.yaml The run will fail with: Sorry, an error occurred in Snapcraft: 'NoneType' object is not subscriptable We would appreciate it if you anonymously reported this issue. Complete trace: Traceback (most recent call last): File "/snap/snapcraft/6954/bin/snapcraft", line 8, in <module> sys.exit(run()) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1137, in __call__ return self.main(*args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1646, in invoke super().invoke(ctx) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(*args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/_runner.py", line 130, in run snap_command.invoke(ctx) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(*args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/lifecycle.py", line 387, in snap _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/lifecycle.py", line 125, in _execute with build_provider_class( File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 87, in __enter__ self.create() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 284, in create self.launch_instance() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 263, in launch_instance self._setup_snapcraft() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 481, in _setup_snapcraft super()._setup_snapcraft() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 508, in _setup_snapcraft snap_injector.apply() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_snap.py", line 392, in apply snap.push_host_snap(file_pusher=self._file_pusher) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_snap.py", line 141, in push_host_snap host_snap_repo.local_download( File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/repo/snaps.py", line 181, in local_download if self.has_assertions(): File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/repo/snaps.py", line 152, in has_assertions return not self.get_local_snap_info()["revision"].startswith("x") TypeError: 'NoneType' object is not subscriptable Expected behavior: 1. If snapcraft --offline is run and there is network and NO cached assets exist, it should inform the user that it needs to pull the assets from the network the first time. 2. If snapcraft -offline is run and there is network and cached assets, it should run as though there is no network; and there should be no errors. 3. If snapcraft --offline is run and there is no network and no cached assets, it should inform the user that it cannot complete the task as there are no available assets that can be retrieved. 4. If snapcraft --offline is run and there is no network and but there are cached assets, it should complete normally. Also, if snapcraft is run without offline mode (not specified) and there is no network, it should check for network status first before trying to launch the container, as the container startup will time out (unspecified) but this behavior cannot be distinguished from: a) slow network b) slow vm/container behavior where it can take a long time (minutes) for the vm/container to start.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 25
Quick Win: 11.25
Staleness: 90
Complexity: 55
Confidence: 68
Support Request: 10
close stale Snapcraft's experimental --offline mode crashes with 'NoneType' object is not subscriptable in snaps.py when network is present, and lacks graceful failover. Reported ~4.8 years ago with no maintainer response; the offline feature was only ever added as a warning-only experimental flag.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 40
Confidence: 90
Support Request: 15
close stale Experimental offline mode crashes with a NoneType error when network is present. Issue is 4.7 years old, has zero comments, and targets outdated Ubuntu versions.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 45
Confidence: 90
Support Request: 15
close stale Experimental offline mode crashes with a TypeError when network is present but assets aren't cached. Issue is 4.5 years old, has zero maintainer interaction, and targets an outdated snapcraft version.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 45
Confidence: 90
Support Request: 10
close stale Experimental offline mode crashes with a TypeError when network is present. The issue is 4.5 years old, has zero comments, and lacks maintainer engagement, indicating the feature or codebase has likely changed significantly.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 45
Confidence: 80
Support Request: 10
close stale Experimental offline mode in snapcraft crashes with a TypeError when network is present but assets aren't cached. Issue is 4.6 years old with no maintainer response or activity.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#3577 (confidence 80%)

    Merged PR that added the experimental --offline CLI flag; it only warns and performs no actions, so the offline behavior described in this issue was never actually implemented.

  • Related To: canonical/snapcraft#3571 (confidence 70%)

    Companion '[WIP] offline' PR that was abandoned and closed without review or merge, indicating the offline feature work was dropped.

Related issues

Issue Project State Summary Similarity
#3577 cli: add experimental --offline option (CRAFT-480) snapcraft merged Merged into master, adding an experimental --offline CLI flag to Snapcraft. The flag currently triggers a warning and performs no actions until offline behavior stabilizes. Approved by two reviewers and passed CI checks.
70%