{"record":{"id":"7a59e00d16086af8","repo":"pytest-dev/pytest","slug":"found-no-collectors-for-arg","errorCode":null,"errorMessage":"found no collectors for {arg}","messagePattern":"found no collectors for (.+?)","errorType":"validation","errorClass":"UsageError","httpStatus":null,"severity":"error","filePath":"src/_pytest/main.py","lineNumber":862,"sourceCode":"                initialpaths_with_parents.append(collection_argument.path)\n                initialpaths_with_parents.extend(collection_argument.path.parents)\n            self._initialpaths = frozenset(initialpaths)\n            self._initialpaths_with_parents = frozenset(initialpaths_with_parents)\n\n            rep = collect_one_node(self)\n            self.ihook.pytest_collectreport(report=rep)\n            self.trace.root.indent -= 1\n            if self._notfound:\n                errors = []\n                for arg, collectors in self._notfound:\n                    if collectors:\n                        errors.append(\n                            f\"not found: {arg}\\n(no match in any of {collectors!r})\"\n                        )\n                    else:\n                        errors.append(f\"found no collectors for {arg}\")\n\n                raise UsageError(*errors)\n\n            if not genitems:\n                items = rep.result\n            else:\n                if rep.passed:\n                    for node in rep.result:\n                        self.items.extend(self.genitems(node))\n\n            self.config.pluginmanager.check_pending()\n            hook.pytest_collection_modifyitems(\n                session=self, config=self.config, items=items\n            )\n        finally:\n            self._notfound = []\n            self._initial_parts = []\n            self._collection_cache = {}\n            hook.pytest_collection_finish(session=self)\n","sourceCodeStart":844,"sourceCodeEnd":880,"githubUrl":"https://github.com/pytest-dev/pytest/blob/0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc/src/_pytest/main.py#L844-L880","documentation":"The companion branch at main.py:862 raises 'found no collectors for {arg}' when a collection argument matched ZERO collector objects (the collectors list is empty/falsy), as opposed to error 112 where collectors existed but matched no item. This means pytest could not turn the argument into any collector at all.","triggerScenarios":"Passing an argument that exists on disk but yields no python test collector (e.g. a non-test .txt file with no collect hook); a path that resolves to nothing collectible; a malformed argument with no matching plugin collector.","commonSituations":"Pointing pytest at a data file or directory with no test modules; a custom collector plugin not loaded; --pyargs referencing a module with no tests; an empty directory given as an argument.","solutions":["Verify the path points to a python file/module containing tests (named test_*.py / *_test.py by default).","Ensure any custom collector plugin is installed and enabled.","Run 'pytest --collect-only <arg>' to see what pytest can collect.","Check python_files / python_classes / python_functions ini settings if names differ."],"exampleFix":"// before\npytest data/fixtures.json\n// after\npytest tests/test_user.py","handlingStrategy":"validation","validationCode":"# Confirm pytest can collect the argument\nimport subprocess, sys\nr = subprocess.run([sys.executable,'-m','pytest','--collect-only', arg],\n                  capture_output=True, text=True)\nif r.returncode != 0 or 'no tests ran' in r.stdout:\n    raise SystemExit(f'{arg!r} yields no collectors; check path/plugin/python_files')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point pytest at test files matching python_files glob.","Ensure custom collector plugins are installed.","Use --collect-only to verify before full runs."],"tags":["pytest","collection","nodeid","cli"],"backgroundTag":null,"analyzedSha":"0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc","analyzedAt":"2026-08-11T20:52:36.969Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}