# Buggy code
def get_staticfiles_finders(self):
    """
    Returns a sorted mapping between the finder path and the list
    of relative and file system paths which that finder was able
    to find.
    """
    finders_mapping = OrderedDict()
    for finder in finders.get_finders():
        for path, finder_storage in finder.list([]):
            if getattr(finder_storage, "prefix", None):
                prefixed_path = join(finder_storage.prefix, path)
            else:
                prefixed_path = path
            finder_cls = finder.__class__
            finder_path = ".".join([finder_cls.__module__, finder_cls.__name__])
            real_path = finder_storage.path(path)
            payload = (prefixed_path, real_path)
            finders_mapping.setdefault(finder_path, []).append(payload)
            self.num_found += 1
    return finders_mapping


# Traceback (FileNotFoundError)
Internal Server Error: /
Traceback (most recent call last):
File "/Users/paul/.dev/police-records/.direnv/python-3.8.5/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/paul/.dev/police-records/.direnv/python-3.8.5/lib/python3.8/site-packages/debug_toolbar/middleware.py", line 92, in __call__
panel.generate_stats(request, response)
File "/Users/paul/.dev/police-records/.direnv/python-3.8.5/lib/python3.8/site-packages/debug_toolbar/panels/staticfiles.py", line 128, in generate_stats
"staticfiles_finders": self.get_staticfiles_finders(),
File "/Users/paul/.dev/police-records/.direnv/python-3.8.5/lib/python3.8/site-packages/debug_toolbar/panels/staticfiles.py", line 140, in get_staticfiles_finders
for path, finder_storage in finder.list([]):
File "/Users/paul/.dev/police-records/.direnv/python-3.8.5/lib/python3.8/site-packages/django/contrib/staticfiles/finders.py", line 130, in list
for path in utils.get_files(storage, ignore_patterns):
File "/Users/paul/.dev/police-records/.direnv/python-3.8.5/lib/python3.8/site-packages/django/contrib/staticfiles/utils.py", line 23, in get_files
directories, files = storage.listdir(location)
File "/Users/paul/.dev/police-records/.direnv/python-3.8.5/lib/python3.8/site-packages/django/core/files/storage.py", line 316, in listdir
for entry in os.scandir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/Users/paul/.dev/police-records/static'

# Fixed code
def get_staticfiles_finders(self):
    """
    Returns a sorted mapping between the finder path and the list
    of relative and file system paths which that finder was able
    to find.
    """
    finders_mapping = OrderedDict()
    for finder in finders.get_finders():
        try:
            for path, finder_storage in finder.list([]):
                if getattr(finder_storage, "prefix", None):
                    prefixed_path = join(finder_storage.prefix, path)
                else:
                    prefixed_path = path
                finder_cls = finder.__class__
                finder_path = ".".join([finder_cls.__module__, finder_cls.__name__])
                real_path = finder_storage.path(path)
                payload = (prefixed_path, real_path)
                finders_mapping.setdefault(finder_path, []).append(payload)
                self.num_found += 1
        except OSError:
            # This error should be captured and presented as a part of run_checks.
            pass
    return finders_mapping