if you install a version of snapcraft via try mode, i.e. `snap try --classic squashfs-root` for an unpacked snapcraft snap, it fails to run because it can't download the snapcraft snap file:
```
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Waiting for network to be ready...
2020-08-21T16:56:10Z INFO Waiting for automatic snapd restart...
core 16-2.45.3.1 from Canonical✓ installed
"core" switched to the "latest/stable" channel
core18 20200807 from Canonical✓ installed
"core18" switched to the "latest/edge" channel
Sorry, an error occurred in Snapcraft:
400 Client Error: Bad Request for url: http+unix://%2Frun%2Fsnapd.socket/v2/snaps/snapcraft/file
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]: yes
Thank you, sent.
You can find the traceback in file '/tmp/tmpn2l6zob_/trace.txt'.
```
Traceback (most recent call last):
File "/snap/snapcraft/x1/bin/snapcraft", line 33, in <module>
sys.exit(load_entry_point('snapcraft==4.1.5.post12+gitfbd93aaa', 'console_scripts', 'snapcraft')())
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 1236, in invoke
return Command.invoke(self, ctx)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/_runner.py", line 132, in run
snap_command.invoke(ctx)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/_command.py", line 88, in invoke
return super().invoke(ctx)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 354, in snap
_execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 116, in _execute
project=project, echoer=echo, build_provider_flags=build_provider_flags
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 87, in __enter__
self.create()
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 284, in create
self.launch_instance()
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 259, in launch_instance
self._setup_snapcraft()
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 470, in _setup_snapcraft
super()._setup_snapcraft()
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 470, in _setup_snapcraft
snap_injector.apply()
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_snap.py", line 394, in apply
snap.push_host_snap(file_pusher=self._file_pusher)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/build_providers/_snap.py", line 141, in push_host_snap
snap_path=snap_file_path, assertion_path=assertion_file_path
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/repo/snaps.py", line 198, in local_download
snap_file_iter = _get_local_snap_file_iter(self.name, chunk_size=1024)
File "/snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/internal/repo/snaps.py", line 373, in _get_local_snap_file_iter
snap_file.raise_for_status()
File "/snap/snapcraft/x1/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+unix://%2Frun%2Fsnapd.socket/v2/snaps/snapcraft/file
This is expected as you cannot download the snap file for a try mode snap: https://github.com/snapcore/snapd/blob/f964a2817cbc0a61aface6104768b6a80c00a2ca/daemon/api_snap_file.go#L63-L65
Thanks for the report. I know this bug is a duplicate of one we already have. If I find that other one I will make it a dup of this one which is easier to find.
We have not done much to solve this as it only affects few snapcraft developers themselves and would require snapd work as we did agree that all our "snap" fetching from the host would be driven by requests to snapd (as seen from the unhandled error)