Huge traceback for normal behavior

Bug #1836182 reported by Gustavo Niemeyer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Medium
Sergio Schvezov

Bug Description

If the file selected is not found, instead of showing a nice and simple error message, Snapcraft is dumping a traceback:

Traceback (most recent call last):
  File "/snap/snapcraft/3059/legacy_snapcraft/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.43.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/_runner.py", line 114, in run
    ctx.forward(lifecyclecli.commands["snap"])
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 216, in snap
    _execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 105, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 90, in execute
    executor.run(step, part_names)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 194, in run
    self._handle_step(part_names, part, step, current_step, cli_config)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 208, in _handle_step
    getattr(self, "_run_{}".format(current_step.name))(part)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 250, in _run_pull
    self._run_step(step=steps.PULL, part=part, progress="Pulling")
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 327, in _run_step
    getattr(part, step.name)()
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 413, in pull
    self._runner.pull()
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 83, in pull
    "override-pull", self._override_pull_scriptlet, self._sourcedir
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 162, in _run_scriptlet
    scriptlet_name, function_call.strip()
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 218, in _handle_builtin_function
    function(**function_args)
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 432, in _do_pull
    self.source_handler.pull()
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/sources/_base.py", line 92, in pull
    source_file = self.download()
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/snapcraft/internal/sources/_base.py", line 128, in download
    request.raise_for_status()
  File "/snap/snapcraft/3059/legacy_snapcraft/lib/python3.5/site-packages/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://builder.blender.org/download/blender-2.80-bb7b741d2f1c-linux-glibc224-x86_64.tar.bz2

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

We've talked about that kind of issue a few times in the past. Instead of fixing that one case for this one exception, we should have a better mechanism to prevent such normal errors from displaying as huge tracebacks.

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

This is only seen when running without a base (legacy code).

Changed in snapcraft:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

While I could not reproduce this on edge, as I currently get:

Pulling foo
Sorry, an error occurred in Snapcraft.
We would appreciate it if you anonymously reported this issue.
No other data than the traceback ('/tmp/tmpakpc3xhn/trace.txt') and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always) [no]:

I did take the opportunity to bring non-base behavior up to par with when using bases, the new experience (brought in through https://github.com/snapcore/snapcraft/pull/2635), should look like:

Pulling foo
Sorry, an error occurred in Snapcraft:
404 Client Error: Not Found for url: https://sergiusens.org/foo.tar
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]:

Changed in snapcraft:
status: Triaged → In Progress
assignee: nobody → Sergio Schvezov (sergiusens)
Changed in snapcraft:
status: In Progress → Fix Committed
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

This is good for a general break down, but this (and many other cases I suspect) is not a general break down. URLs pointing to non-existing content is a trivial and mundane problem that should be reported as such:

    Server has no content (404) at <URL>

Or something similarly clean and tidy.

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Thanks, the normal behavior for snapcraft for URLs when using bases is to have a nice error message. I have worked on one for FileNotFound and will have a PR up shortly.

Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.