{"record":{"id":"5117955129ee94d6","repo":"pytest-dev/pytest","slug":"not-found-arg-no-match-in-any-of-collectors-r","errorCode":null,"errorMessage":"not found: {arg}\n(no match in any of {collectors!r})","messagePattern":"not found: (.+?)\n\\(no match in any of (.+?)\\)","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":"main.py:862 reports 'not found: {arg}\\n(no match in any of {collectors!r})' during collection when a command-line argument resolved to one or more collector objects but none of them produced matching items for the given selection. The argument was located as a collector but the '::part' or pattern did not match any test inside. This is a UsageError raised after _notfound entries accumulate.","triggerScenarios":"Running 'pytest path/to/test_file.py::TestClass::test_wrong_name' where the method does not exist; selecting a class/function name that has a typo; using a nodeid whose '::' parts reference an absent nested item.","commonSituations":"Renaming a test and forgetting to update CI invocation strings; stale nodeids copied from old runs; selecting parametrized IDs that no longer exist; wrong class name in a deselect/keyword context.","solutions":["Run 'pytest path/to/test_file.py --collect-only' to list the exact valid nodeids.","Correct the '::part' spelling in the command to match an existing test/class.","If the test was removed, update CI configs and scripts referencing it.","Use --co -q to get machine-readable nodeids for copy-paste."],"exampleFix":"// before\npytest tests/test_user.py::TestUser::test_delet  # typo\n// after\npytest tests/test_user.py::TestUser::test_delete","handlingStrategy":"validation","validationCode":"# Before running, list valid nodeids and verify the target exists\nimport subprocess, sys\nout = subprocess.run([sys.executable,'-m','pytest','--collect-only','-q', path],\n                    capture_output=True, text=True).stdout\nnodeids = {l.strip() for l in out.splitlines() if '::' in l}\nassert target in nodeids, f'{target!r} not in collected nodeids'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate nodeids via --collect-only -q and copy exact strings.","Update CI references when tests are renamed.","Run a collect-only step in CI to fail fast on stale nodeids."],"tags":["pytest","collection","nodeid","selection","cli"],"backgroundTag":null,"analyzedSha":"0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc","analyzedAt":"2026-08-11T20:52:36.969Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}