{"record":{"id":"4f3bf2b479f55d5a","repo":"pytest-dev/pytest","slug":"unknown-parametrize-long-str-id-strategy-value-r","errorCode":null,"errorMessage":"Unknown parametrize_long_str_id_strategy: {value!r}. Valid values: {', '.join(sorted(_LONG_STR_STRATEGIES))}","messagePattern":"Unknown parametrize_long_str_id_strategy: (.+?)\\. Valid values: (.+?)","errorType":"validation","errorClass":"UsageError","httpStatus":null,"severity":"error","filePath":"src/_pytest/python.py","lineNumber":1041,"sourceCode":"        idval = self._idval_from_hook(val, argname)\n        if idval is not None:\n            return idval\n        if isinstance(val, str | bytes):\n            idval = self._apply_long_str_strategy(val, argname, idx)\n            if idval is not None:\n                return idval\n        else:\n            idval = self._idval_from_value(val)\n            if idval is not None:\n                return idval\n        return self._idval_from_argname(argname, idx)\n\n    def _get_long_str_strategy(self) -> LongStrIdStrategy:\n        if not self.config:\n            return \"short\"\n        value = self.config.getini(\"parametrize_long_str_id_strategy\")\n        if value not in _LONG_STR_STRATEGIES:\n            raise UsageError(\n                f\"Unknown parametrize_long_str_id_strategy: {value!r}. \"\n                f\"Valid values: {', '.join(sorted(_LONG_STR_STRATEGIES))}\"\n            )\n        return cast(LongStrIdStrategy, value)\n\n    def _apply_long_str_strategy(\n        self, val: str | bytes, argname: str, idx: int\n    ) -> str | None:\n        \"\"\"Apply the configured strategy for long str/bytes parameter values.\n\n        Only used for auto-generated IDs (not explicit ids=[...] or\n        pytest.param(id=...)).\n        \"\"\"\n        if len(val) <= 100:\n            return _ascii_escaped_by_config(val, self.config)\n        match self._get_long_str_strategy():\n            case \"legacy\":\n                return _ascii_escaped_by_config(val, self.config)","sourceCodeStart":1023,"sourceCodeEnd":1059,"githubUrl":"https://github.com/pytest-dev/pytest/blob/0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc/src/_pytest/python.py#L1023-L1059","documentation":"Thrown by Metafunc._get_long_str_strategy() when the ini value `parametrize_long_str_id_strategy` is not one of the recognized literals: 'short', 'sha256', 'legacy', 'disallow'. It guards config typos before they affect parametrize id generation.","triggerScenarios":"Setting parametrize_long_str_id_strategy = sha in pytest.ini (truncated); a typo like 'sha-256' or 'SHA256' (case-sensitive); an old config from a pytest version that supported a different value set.","commonSituations":"Upgrading pytest and finding the strategy name changed; copy-paste from docs with a typo; case mismatch.","solutions":["Set the value to one of: short, sha256, legacy, disallow (lowercase, exact).","Remove the ini key to fall back to the default ('short').","Check for typos and trailing whitespace in the ini value."],"exampleFix":"// before - pytest.ini\n[pytest]\nparametrize_long_str_id_strategy = SHA-256\n// after\n[pytest]\nparametrize_long_str_id_strategy = sha256","handlingStrategy":"validation","validationCode":"valid = {'short', 'sha256', 'legacy', 'disallow'}\nvalue = config.getini('parametrize_long_str_id_strategy')\nif value not in valid:\n    raise ValueError(f'bad strategy {value!r}, choose from {sorted(valid)}')","typeGuard":"def is_valid_strategy(v: object) -> bool:\n    return v in {'short', 'sha256', 'legacy', 'disallow'}","tryCatchPattern":null,"preventionTips":["Use lowercase exact spellings: short, sha256, legacy, disallow.","Remove the ini key to use the default rather than guessing.","Re-check valid values after pytest upgrades."],"tags":["parametrize","ini-config","config","validation"],"backgroundTag":null,"analyzedSha":"0d6fbdeffa57c796123f62f81f7dd370d9b7ecdc","analyzedAt":"2026-08-11T20:52:36.969Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}