{"record":{"id":"9bc98c157e42f4e8","repo":"django/django","slug":"no-fixture-named-s-found","errorCode":null,"errorMessage":"No fixture named '%s' found.","messagePattern":"No fixture named '(.+?)' found\\.","errorType":"console","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"django/core/management/commands/loaddata.py","lineNumber":351,"sourceCode":"                fixture_name,\n                targets,\n            )\n            if self.verbosity >= 2 and not fixture_files_in_dir:\n                self.stdout.write(\n                    \"No fixture '%s' in %s.\" % (fixture_name, humanize(fixture_dir))\n                )\n\n            # Check kept for backwards-compatibility; it isn't clear why\n            # duplicates are only allowed in different directories.\n            if len(fixture_files_in_dir) > 1:\n                raise CommandError(\n                    \"Multiple fixtures named '%s' in %s. Aborting.\"\n                    % (fixture_name, humanize(fixture_dir))\n                )\n            fixture_files.extend(fixture_files_in_dir)\n\n        if not fixture_files:\n            raise CommandError(\"No fixture named '%s' found.\" % fixture_name)\n\n        return fixture_files\n\n    @cached_property\n    def fixture_dirs(self):\n        \"\"\"\n        Return a list of fixture directories.\n\n        The list contains the 'fixtures' subdirectory of each installed\n        application, if it exists, the directories in FIXTURE_DIRS, and the\n        current directory.\n        \"\"\"\n        dirs = []\n        fixture_dirs = settings.FIXTURE_DIRS\n        if len(fixture_dirs) != len(set(fixture_dirs)):\n            raise ImproperlyConfigured(\"settings.FIXTURE_DIRS contains duplicates.\")\n        for app_config in apps.get_app_configs():\n            app_label = app_config.label","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/django/django/blob/ae25a40be07e8a749edf526df37c93e59d4a22c9/django/core/management/commands/loaddata.py#L333-L369","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n# fixture at /opt/data/seed.json, not searched\npython manage.py loaddata seed\n// after\n# settings.py\nFIXTURE_DIRS = ['/opt/data']\npython manage.py loaddata seed  # now resolved","handlingStrategy":"validation","validationCode":"import os\nfrom django.conf import settings\n\ndef fixture_resolvable(name: str) -> bool:\n    from django.core.serializers import get_serializer_formats\n    fmts = get_serializer_formats()\n    for d in (*[os.path.join(p, 'fixtures') for p in getattr(settings, 'FIXTURE_DIRS', [])],\n              *settings.FIXTURE_DIRS):\n        for fmt in fmts:\n            if os.path.exists(os.path.join(d, f'{name}.{fmt}')):\n                return True\n    return False","typeGuard":"def fixture_exists(name) -> bool:\n    return fixture_resolvable(name)","tryCatchPattern":"from django.core.management.base import CommandError\nfrom django.core.management import call_command\n\ntry:\n    call_command('loaddata', 'seed')\nexcept CommandError as e:\n    logger.error('Fixture not found: %s. Run with -v 2 to see searched dirs.', e)\n    raise","preventionTips":["Add external fixture dirs to settings.FIXTURE_DIRS.","Run loaddata -v 2 to confirm searched directories.","Check fixture name spelling and case."],"tags":["django","loaddata","fixtures","management-command","file-not-found"],"analyzedSha":"ae25a40be07e8a749edf526df37c93e59d4a22c9","analyzedAt":"2026-08-06T21:46:51.801Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}