Troubleshooting a Django collectstatic Error After Upgrading to Version 4.2.


I’m encountering an issue with the collectstatic command, which persisted until I upgraded Django to version 4.2. When I execute ./ collectstatic, it throws an error that says:
my_path/’ could not be found with <project.assets.CustomStorage object at 0x7f1af8be4370>,”

and I’m struggling to understand the cause.

In my file, I’ve configured the STORAGES dictionary for static files as follows:

STORAGES["staticfiles"] = {"BACKEND": "project.assets.CustomStorage"}

Where CustomStorage is a custom class defined as:

class CustomStorage(ManifestFilesMixin, S3Boto3Storage):
    location = settings.AWS_ASSETS_BUCKET_FOLDER
    querystring_auth = False
    bucket_name = settings.AWS_ASSETS_BUCKET_NAME

Would you be able to assist me in resolving this issue?

Same issue here.

This occurs when I use S3Boto3Storage with ManifestFilesMixin.

I use django 4.2, python3.11, django-storages 1.13.2.

I think I found a pattern here. It seems django is trying to find file that has .map extension.

For me the missing file that django couldn’t find is swiper-bundle.min.js

Post-processing 'js/3rdparty/swiper-bundle.min.js' failed!
ValueError: The file 'js/3rdparty/' could not be found with < object at 0x7f7823ab8850>.

Not much a progress to be honest though.

I don’t think that’s the case here. I think it’s finding that file, but not finding the related map file.

I’m guessing that the storage class is either using the ManifestStaticFilesStorage class or doing the same thing as this class regarding map files. (The docs specify that the map files are processed by this class.)

Look for a file by that name in that third-party package and include it in your project.

Thanks for reaching me out.

I did check whether the file exists.

First it does exist in s3 bucket.

Screenshot 2023-11-12 at 12.28.14 AM

Secondly, the file also exists in my project.
Screenshot 2023-11-12 at 12.29.44 AM

So I’m clueless what’s actually going on here.


As I was browsing the document, I noticed the following section:

If a file isn’t found in the staticfiles.json manifest at runtime, a ValueError is raised. This behavior can be disabled by subclassing ManifestStaticFilesStorage and setting the manifest_strict attribute to False – nonexistent paths will remain unchanged.

So if I set the attribute False aforementioned, what risks could there be?

Yes, the .js file exists. What about the file? That’s what the message is telling you is missing.

Forget about what I wrote on manifest_strict. The error seems to happen regardless of the attribute.

class ManifestFilesMixin(HashedFilesMixin):
    def stored_name(self, name):
        cache_name = self.hashed_files.get(hash_key)
        if cache_name is None:
            if self.manifest_strict:
                raise ValueError(
                    "Missing staticfiles manifest entry for '%s'" % clean_name
            cache_name = self.clean_name(self.hashed_name(name))  # thread gets in hased_name method first
class HashedFilesMixin:
    def hashed_name(self, name, content=None, filename=None):
        if opened:
            if not self.exists(filename):
                raise ValueError(
                    "The file '%s' could not be found with %r." % (filename, self)  # and error occurs here
                content =
            except OSError:
                # Handle directory paths and fragments
                return name

As the comments in the code snippet stated, the error would have occured anyway even if I had set manifest_strict True.

.map file doesn’t exist neither in my proejct static nor s3 bucket. It never did.

I’m not sure why django is looking for the map extension.

That’s one I can’t answer beyond the fact that the docs mention that those files are included in the regex being used to look for files. I’d check to see if that file is available from whatever your source is for this package.

(I can also mention that we’ve gotten around errors related to map files in the past by just creating a blank file with the right name. We’ve never needed a real map file.)

I figured out what went wrong.

It’s true that my project does not have .map file. But the name of the file was written in one of the files as comment.

//# sourceMappingURL=js/3rdparty/

I had quite a good number of files with such comments. Besides, I had css files that reference image file as url but does not exist in reality.

After I removed all the wrong lines from files, post_process finally stopped complaining.

Thank you all!