django/django · error · CommandError
No fixture named '%s' found.
Error message
No fixture named '%s' found.
What it means
Raised by loaddata when, after scanning every candidate directory (app fixtures/, FIXTURE_DIRS, and cwd), zero fixture files matched the requested name (loaddata.py:350-351). Django searches all dirs returned by the fixture_dirs cached property for files matching <name>.<fmt>[.<cmp>] across all known serialization and compression formats; an empty result means nothing resolvable was found anywhere.
Source
Thrown at django/core/management/commands/loaddata.py:351
fixture_name,
targets,
)
if self.verbosity >= 2 and not fixture_files_in_dir:
self.stdout.write(
"No fixture '%s' in %s." % (fixture_name, humanize(fixture_dir))
)
# Check kept for backwards-compatibility; it isn't clear why
# duplicates are only allowed in different directories.
if len(fixture_files_in_dir) > 1:
raise CommandError(
"Multiple fixtures named '%s' in %s. Aborting."
% (fixture_name, humanize(fixture_dir))
)
fixture_files.extend(fixture_files_in_dir)
if not fixture_files:
raise CommandError("No fixture named '%s' found." % fixture_name)
return fixture_files
@cached_property
def fixture_dirs(self):
"""
Return a list of fixture directories.
The list contains the 'fixtures' subdirectory of each installed
application, if it exists, the directories in FIXTURE_DIRS, and the
current directory.
"""
dirs = []
fixture_dirs = settings.FIXTURE_DIRS
if len(fixture_dirs) != len(set(fixture_dirs)):
raise ImproperlyConfigured("settings.FIXTURE_DIRS contains duplicates.")
for app_config in apps.get_app_configs():
app_label = app_config.labelView on GitHub (pinned to ae25a40be0)
Solutions
- Pass the -v 2 flag to see which directories Django searches and confirm your fixture's location is among them.
- Add the directory to settings.FIXTURE_DIRS, or place the file under <app>/fixtures/.
- Double-check spelling and case of the fixture name and its extension.
- If using a non-default format, ensure the extension (e.g. .yaml) is registered as a serializer.
Example fix
// before # fixture at /opt/data/seed.json, not searched python manage.py loaddata seed // after # settings.py FIXTURE_DIRS = ['/opt/data'] python manage.py loaddata seed # now resolved
Defensive patterns
Strategy: validation
Validate before calling
import os
from django.conf import settings
def fixture_resolvable(name: str) -> bool:
from django.core.serializers import get_serializer_formats
fmts = get_serializer_formats()
for d in (*[os.path.join(p, 'fixtures') for p in getattr(settings, 'FIXTURE_DIRS', [])],
*settings.FIXTURE_DIRS):
for fmt in fmts:
if os.path.exists(os.path.join(d, f'{name}.{fmt}')):
return True
return False Type guard
def fixture_exists(name) -> bool:
return fixture_resolvable(name) Try / catch
from django.core.management.base import CommandError
from django.core.management import call_command
try:
call_command('loaddata', 'seed')
except CommandError as e:
logger.error('Fixture not found: %s. Run with -v 2 to see searched dirs.', e)
raise Prevention
- Add external fixture dirs to settings.FIXTURE_DIRS.
- Run loaddata -v 2 to confirm searched directories.
- Check fixture name spelling and case.
When it happens
Trigger: Typo in the fixture label passed to `loaddata`; fixture file in a directory Django does not search (not under an app's fixtures/ nor in FIXTURE_DIRS); wrong extension that is neither a serialization nor compression format; passing an absolute path that doesn't exist; case-sensitivity mismatch on case-sensitive filesystems.
Common situations: Forgetting to add the fixtures directory to FIXTURE_DIRS when it lives outside an app; renaming a fixture but not the loaddata call; running loaddata from a different working directory than where the fixture lives; pushing a fixture in .gitignore so it's absent in CI.
Related errors
- Multiple fixtures named '%s' in %s. Aborting.
- --format must be specified when reading from stdin.
- Problem installing fixture '%s': %s is not a known serializa
- Zip-compressed fixtures must contain one file.
- settings.FIXTURE_DIRS contains duplicates.
AI-assisted analysis of django/django@ae25a40be0 (2026-08-06).
Data as JSON: /api/errors/9bc98c157e42f4e8.
Report an issue: GitHub.