{"record":{"id":"858d32903583257a","repo":"pytest-dev/pytest","slug":"unknown-configuration-type-type","errorCode":null,"errorMessage":"unknown configuration type: {type}","messagePattern":"unknown configuration type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/_pytest/legacypath.py","lineNumber":395,"sourceCode":"def Session_startdir(self: Session) -> LEGACY_PATH:\n    \"\"\"The path from which pytest was invoked.\n\n    Prefer to use ``startpath`` which is a :class:`pathlib.Path`.\n\n    :type: LEGACY_PATH\n    \"\"\"\n    return legacy_path(self.startpath)\n\n\ndef Config__getini_unknown_type(self, name: str, type: str, value: str | list[str]):\n    if type == \"pathlist\":\n        # TODO: This assert is probably not valid in all cases.\n        assert self.inipath is not None\n        dp = self.inipath.parent\n        input_values = shlex.split(value) if isinstance(value, str) else value\n        return [legacy_path(str(dp / x)) for x in input_values]\n    else:\n        raise ValueError(f\"unknown configuration type: {type}\", value)\n\n\ndef Node_fspath(self: Node) -> LEGACY_PATH:\n    \"\"\"(deprecated) returns a legacy_path copy of self.path\"\"\"\n    return legacy_path(self.path)\n\n\ndef Node_fspath_set(self: Node, value: LEGACY_PATH) -> None:\n    self.path = Path(value)\n\n\n@hookimpl(tryfirst=True)\ndef pytest_load_initial_conftests(early_config: Config) -> None:\n    \"\"\"Monkeypatch legacy path attributes in several classes, as early as possible.\"\"\"\n    mp = MonkeyPatch()\n    early_config.add_cleanup(mp.undo)\n\n    # Add Cache.makedir().","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/pytest-dev/pytest/blob/0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc/src/_pytest/legacypath.py#L377-L413","documentation":"Config__getini_unknown_type (legacypath.py:395) handles ini option retrieval for the legacy 'pathlist' type and raises ValueError('unknown configuration type: {type}', value) for any other unrecognized type. This path is reached when a plugin registers an ini option with a 'type' string that the core config does not know how to coerce (only 'pathlist' is handled here as a legacy shim).","triggerScenarios":"A plugin/conftest calling parser.addini('opt', type='mytype') where 'mytype' is not one of the recognized type names, and then code calls config.getini('opt') triggering the legacy fallback; mixing the fspath/legacypath compatibility layer with a custom type.","commonSituations":"Custom ini types added without registering a corresponding getini handler; pytest version mismatch where a type previously handled by legacypath no longer is; plugin conflicts overriding getini behavior.","solutions":["Use a standard type string in addini (e.g. 'string', 'bool', 'int', 'pathlist', 'args', 'linelist', 'paths').","If a custom type is required, post-process the raw string value yourself instead of declaring a custom type.","Verify the ini option's registered type against the list supported by your pytest version."],"exampleFix":"// before\nparser.addini('targets', type='csvlist', default=[])\nvalue = config.getini('targets')\n// after\nparser.addini('targets', type='linelist', default=[])\nvalue = [x.split(',') for x in config.getini('targets'))]","handlingStrategy":"validation","validationCode":"ALLOWED = {'string','bool','int','float','pathlist','paths','args','linelist','choice'}\ndef addini_checked(parser, name, type, help, **kw):\n    assert type in ALLOWED, f'unsupported ini type {type!r}; use one of {ALLOWED}'\n    parser.addini(name, type=type, help=help, **kw)","typeGuard":"def is_known_ini_type(t: str) -> bool:\n    return t in {'string','bool','int','float','pathlist','paths','args','linelist','choice'}","tryCatchPattern":null,"preventionTips":["Use only standard ini type strings.","Post-process raw string values for custom formats.","Document each custom ini option's type."],"tags":["pytest","config","ini","legacy","plugin"],"backgroundTag":null,"analyzedSha":"0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc","analyzedAt":"2026-08-11T20:52:36.969Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}