{"id":"9b0393bb9627a95b","repo":"pytest-dev/pytest","slug":"name-9b0393","errorCode":null,"errorMessage":"{name}","messagePattern":"\\{name\\}","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/_pytest/python.py","lineNumber":1212,"sourceCode":"                raise nodes.Collector.CollectError(\n                    f\"{nodeid}: duplicate parametrization of {arg!r}\"\n                )\n            params[arg] = val\n            indices[arg] = param_index\n            arg2scope[arg] = scope\n        return CallSpec(\n            params=params,\n            indices=indices,\n            _arg2scope=arg2scope,\n            _idlist=self._idlist if id is HIDDEN_PARAM else [*self._idlist, id],\n            marks=[*self.marks, *normalize_mark_list(marks)],\n        )\n\n    def getparam(self, name: str) -> object:\n        try:\n            return self.params[name]\n        except KeyError as e:\n            raise ValueError(name) from e\n\n    @property\n    def id(self) -> str:\n        return \"-\".join(self._idlist)\n\n\nif TYPE_CHECKING:\n    # Deprecated alias kept for type checkers; runtime access goes through __getattr__.\n    CallSpec2 = CallSpec\n\n\ndef get_direct_param_fixture_func(request: FixtureRequest) -> Any:\n    return request.param\n\n\nclass DirectParamFixtureDef(FixtureDef[FixtureValue]):\n    \"\"\"A custom FixtureDef for direct parametrization fixtures.\n","sourceCodeStart":1194,"sourceCodeEnd":1230,"githubUrl":"https://github.com/pytest-dev/pytest/blob/98b357f69e380da908740a212288d73b2ee06687/src/_pytest/python.py#L1194-L1230","documentation":"Raised by CallSpec.getparam when the requested fixture/parameter name is not present in the CallSpec's params mapping. The exception message is just the missing name (a ValueError). This is an internal API used by pytest's fixture machinery to resolve a parameter value for a given argname within a specific callspec.","triggerScenarios":"Calling callspec.getparam('some_name') where 'some_name' was not part of the parametrize call that produced this callspec, or where the param was provided indirectly and not stored in params.","commonSituations":"Plugin or fixture code that introspects CallSpec objects and asks for an argname that doesn't exist for the current test; indirect parametrization where the name was misregistered; typos in argname lookups.","solutions":["Check 'name in callspec.params' before calling getparam.","Use callspec.params.get(name, default) instead of getparam when absence is possible.","Verify the argname spelling matches the parametrize declaration."],"exampleFix":"// before\nval = callspec.getparam(\"usrname\")  # typo\n// after\nif \"username\" in callspec.params:\n    val = callspec.getparam(\"username\")\nelse:\n    val = None","handlingStrategy":"validation","validationCode":"name = \"username\"\nif name in callspec.params:\n    val = callspec.getparam(name)\nelse:\n    val = callspec.params.get(name)","typeGuard":null,"tryCatchPattern":"try:\n    val = callspec.getparam(name)\nexcept ValueError:\n    val = None","preventionTips":["Check membership in callspec.params before getparam.","Prefer callspec.params.get(name) when absence is acceptable.","Keep argname spellings consistent with parametrize declarations."],"tags":["parametrize","internal","lookup"],"analyzedSha":"98b357f69e380da908740a212288d73b2ee06687","analyzedAt":"2026-08-04T20:26:34.442Z","schemaVersion":2}