{"record":{"id":"9d95654a604841a7","repo":"pytest-dev/pytest","slug":"no-name-r-checker-available-for-self-path-r","errorCode":null,"errorMessage":"no {name!r} checker available for {self.path!r}","messagePattern":"no (.+?) checker available for (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/_pytest/_py/path.py","lineNumber":86,"sourceCode":"        return str(self.path).endswith(arg)\n\n    def _evaluate(self, kw):\n        from .._code.source import getrawcode\n\n        for name, value in kw.items():\n            invert = False\n            meth = None\n            try:\n                meth = getattr(self, name)\n            except AttributeError:\n                if name[:3] == \"not\":\n                    invert = True\n                    try:\n                        meth = getattr(self, name[3:])\n                    except AttributeError:\n                        pass\n            if meth is None:\n                raise TypeError(f\"no {name!r} checker available for {self.path!r}\")\n            try:\n                if getrawcode(meth).co_argcount > 1:\n                    if (not meth(value)) ^ invert:\n                        return False\n                else:\n                    if bool(value) ^ bool(meth()) ^ invert:\n                        return False\n            except (error.ENOENT, error.ENOTDIR, error.EBUSY):\n                # EBUSY feels not entirely correct,\n                # but its kind of necessary since ENOMEDIUM\n                # is not accessible in python\n                for name in self._depend_on_existence:\n                    if name in kw:\n                        if kw.get(name):\n                            return False\n                    name = \"not\" + name\n                    if name in kw:\n                        if not kw.get(name):","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/pytest-dev/pytest/blob/0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc/src/_pytest/_py/path.py#L68-L104","documentation":"The legacy py.path.local Checkers._evaluate method resolves each keyword passed to path.check(**kw) by attribute lookup on the Checkers instance. Valid checkers include: exists, link, dir, file, dotfile, ext, basename, basestarts, relto, fnmatch, endswith (and their not* inverses like notdir, notfile). If the keyword name matches none of these and is not a not*-prefixed valid checker, pytest raises TypeError naming the unknown checker and the path.","triggerScenarios":"Calling path.check(unknownname=1); path.check(mispelled=1) (e.g., direktory, diretory); path.check(directory=1) instead of dir=1. Triggered at Checkers._evaluate (src/_pytest/_py/path.py:85-86).","commonSituations":"Migrating from pathlib (which uses .is_dir()) and guessing py.path checker names; typos in checker names; using a checker name from an older py library version.","solutions":["Use a valid checker name: file, dir, link, exists, dotfile, ext, basename, basestarts, relto, fnmatch, endswith.","For negation, prefix with not: path.check(notdir=1), path.check(notfile=1).","Prefer the modern pathlib API (Path.is_dir(), Path.is_file()) for new code; py.path is legacy."],"exampleFix":"# before\npath.check(direktory=1)\n# after\npath.check(dir=1)","handlingStrategy":"type-guard","validationCode":"VALID_CHECKERS = {\n    'exists', 'link', 'dir', 'file', 'dotfile', 'ext',\n    'basename', 'basestarts', 'relto', 'fnmatch', 'endswith',\n}\ndef validate_check_kwargs(kw: dict) -> None:\n    for name in kw:\n        base = name[3:] if name.startswith('not') else name\n        if base not in VALID_CHECKERS:\n            raise TypeError(f'no {name!r} checker available; valid: {sorted(VALID_CHECKERS)}')\n# usage\nvalidate_check_kwargs({'dir': 1})\npath.check(dir=1)","typeGuard":"VALID = {'exists','link','dir','file','dotfile','ext','basename','basestarts','relto','fnmatch','endswith'}\ndef is_valid_checker(name: str) -> bool:\n    base = name[3:] if name.startswith('not') else name\n    return base in VALID","tryCatchPattern":null,"preventionTips":["Use only documented checker names: file, dir, link, exists, dotfile, ext, basename, basestarts, relto, fnmatch, endswith.","Prefix with not for negation (notdir, notfile).","Prefer pathlib (Path.is_dir/is_file) for new code; py.path is legacy."],"tags":["pytest","localpath","py-path","checker","validation","legacy"],"backgroundTag":null,"analyzedSha":"0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc","analyzedAt":"2026-08-11T20:52:36.969Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}