{"record":{"id":"beace41af198b4d5","repo":"huggingface/transformers","slug":"some-specified-arguments-are-not-used-by-the-hfarg","errorCode":null,"errorMessage":"Some specified arguments are not used by the HfArgumentParser: {remaining_args}","messagePattern":"Some specified arguments are not used by the HfArgumentParser: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/hf_argparser.py","lineNumber":354,"sourceCode":"            # args specified via the command line should overwrite args from files, so we add them last\n            args = file_args + args if args is not None else file_args + sys.argv[1:]\n        namespace, remaining_args = self.parse_known_args(args=args)\n        outputs = []\n        for dtype in self.dataclass_types:\n            keys = {f.name for f in dataclasses.fields(dtype) if f.init}\n            inputs = {k: v for k, v in vars(namespace).items() if k in keys}\n            for k in keys:\n                delattr(namespace, k)\n            obj = dtype(**inputs)\n            outputs.append(obj)\n        if len(namespace.__dict__) > 0:\n            # additional namespace.\n            outputs.append(namespace)\n        if return_remaining_strings:\n            return (*outputs, remaining_args)\n        else:\n            if remaining_args:\n                raise ValueError(f\"Some specified arguments are not used by the HfArgumentParser: {remaining_args}\")\n\n            return (*outputs,)\n\n    def parse_dict(self, args: dict[str, Any], allow_extra_keys: bool = False) -> tuple[DataClass, ...]:\n        \"\"\"\n        Alternative helper method that does not use `argparse` at all, instead uses a dict and populating the dataclass\n        types.\n\n        Args:\n            args (`dict`):\n                dict containing config values\n            allow_extra_keys (`bool`, *optional*, defaults to `False`):\n                Defaults to False. If False, will raise an exception if the dict contains keys that are not parsed.\n\n        Returns:\n            Tuple consisting of:\n\n                - the dataclass instances in the same order as they were passed to the initializer.","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/hf_argparser.py#L336-L372","documentation":"Error \"Some specified arguments are not used by the HfArgumentParser: {remaining_args}\" thrown in huggingface/transformers.","triggerScenarios":"Raised in HfArgumentParser.parse_args_into_dataclasses when unrecognized CLI arguments remain after parsing.","commonSituations":"Typos in command-line flags or passing arguments for a different script to a Trainer-based entrypoint.","solutions":["Remove the unused CLI arguments or add matching fields to the dataclass.","Check for typos between CLI flags and dataclass field names."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}