question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

serving non-existent favicon.ico with staticfile throws error on refresh

See original GitHub issue

Originally reported by: @wyuenho


So apparently Tree.mount() attaches a static handler for favicon.ico if the root doesn’t already have a handler for it without even looking at the config. If the config has a section for /favicon.ico, but the file doesn’t exist, refreshing the browser will throw and error in the errorlog with something like this:

[17/Jan/2010:01:30:00] HTTP Traceback (most recent call last):
  File "/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.5/site-packages/CherryPy-3.1.2-py2.5.egg/cherrypy/_cprequest.py", line 606, in respond
    cherrypy.response.body = self.handler()
  File "/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.5/site-packages/CherryPy-3.1.2-py2.5.egg/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.5/site-packages/CherryPy-3.1.2-py2.5.egg/cherrypy/_cptools.py", line 150, in handle_func
    handled = self.callable(*args, **self._merged_args(kwargs))
TypeError: staticfile() got multiple values for keyword argument 'filename'

This obviously doesn’t even tell me what values it got, so the error message doesn’t even help. I’m not sure how to patch this because you need to obviously look at all the different kinds of dispatchers for the “/favicon.ico” key besides the default tree dispatcher, and I’m not familiar with all of them.

Reported by wyuenho@gmail.com


Issue Analytics

  • State:open
  • Created 14 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
webknjazcommented, Aug 15, 2018

In #1623 @sanjaySP suggested to register a custom path for favicon and explicitly specify that in your HTML pages as a workaround.

1reaction
webknjazcommented, Jul 21, 2018

With the monkey-patch from #1623 (comment) (which I don’t understand at all) , the traceback is gone.

That patch removes the duplicate argument. But it “cures” the symptom, not an underlying issue. It looks like the fix should be done on a different level, being more fundamental. The patch might hide other problems if they happen, which would then be impossible to debug.

To truly fix the issue, we need to understand the flow across different components of the framework and why this is happening. Otherwise patching random places would be harmful.

Basically, this is why I postponed the fix, it needs mode dedicated investigation first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: Missing staticfiles manifest entry for 'favicon.ico'
Try running: python manage.py collectstatic. Does the test work now? If so, this might be the configuration causing a problem:
Read more >
Favicon Not Showing Up - How to Fix In Chrome, Wordpress ...
It's frustrating when for some reason, your favicon is not showing up, and this can occur for many reasons we explain such as...
Read more >
gin - Go Packages
StaticFile registers a single route in order to serve a single file of the local filesystem. router.StaticFile("favicon.ico", ".
Read more >
Assets, CSS, Images, etc - SymfonyCasts
Refresh and... it doesn't! Error: Unknown function: did you forget to run composer require ... <link rel="icon" type="image/png" sizes="32x32" href="{{ ...
Read more >
Using WhiteNoise with Django
Note, if the static file does not exist, it will still throw an error. This works by setting the manifest_strict option on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found