{"id":"858d32903583257a","repo":"pytest-dev/pytest","slug":"unknown-configuration-type-type","errorCode":null,"errorMessage":"unknown configuration type: {type}","messagePattern":"unknown configuration type: (.+?)","errorType":"exception","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/98b357f69e380da908740a212288d73b2ee06687/src/_pytest/legacypath.py#L377-L413","documentation":"Raised by the legacy-path compatibility shim `Config__getini_unknown_type` when `config.getini(name)` encounters an ini option whose registered type is neither a standard pytest type nor the legacy \"pathlist\". The shim only knows how to convert \"pathlist\"; any other unknown type string bubbles up as ValueError carrying the type and value.","triggerScenarios":"A plugin registers an ini option with a non-standard `type=` value (e.g. `type=\"json\"`) and the value is later read through the legacy path layer, or `legacypath` is the only handler available for that type. The error reports the offending type string.","commonSituations":"Custom plugin defining a bespoke ini type. Version mismatch between a plugin and pytest where a type name changed. Mis-typed `addini(..., type=\"sting\")` typo.","solutions":["Use one of the standard ini types (\"string\", \"paths\", \"pathlist\", \"args\", \"linelist\", \"bool\") in `addini`.","If a custom type is needed, handle parsing yourself and register the option as a plain string.","Update/check the plugin that registered the option for a typo or incompatible type name."],"exampleFix":"// before\nparser.addini(\"my_opt\", type=\"json\", default=\"{}\")  # unknown type\n// after\nparser.addini(\"my_opt\", type=\"string\", default=\"{}\")\n# then parse JSON yourself when reading","handlingStrategy":"validation","validationCode":"VALID_INI_TYPES = {\"string\", \"paths\", \"pathlist\", \"args\", \"linelist\", \"bool\"}\n\ndef safe_addini(parser, name, type=None, **kw):\n    if type is not None and type not in VALID_INI_TYPES:\n        raise ValueError(f\"unknown configuration type: {type}\")\n    parser.addini(name, type=type, **kw)","typeGuard":"def is_known_ini_type(type_name: str) -> bool:\n    return type_name in {\"string\", \"paths\", \"pathlist\", \"args\", \"linelist\", \"bool\"}","tryCatchPattern":null,"preventionTips":["Use only standard ini types when registering options.","Parse custom formats yourself from a string-typed option.","Check for typos in the type argument."],"tags":["pytest","config","legacypath","ini","valueerror"],"analyzedSha":"98b357f69e380da908740a212288d73b2ee06687","analyzedAt":"2026-08-04T20:26:34.442Z","schemaVersion":2}