{"record":{"id":"0812bc406e5d3667","repo":"open-mmlab/mmdetection","slug":"the-file-client-args-is-deprecated-please-use-0812bc","errorCode":null,"errorMessage":"The `file_client_args` is deprecated, please use `backend_args` instead, please refer tohttps://github.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection.py","messagePattern":"The `file_client_args` is deprecated, please use `backend_args` instead, please refer tohttps://github\\.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection\\.py","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mmdet/evaluation/metrics/cityscapes_metric.py","lineNumber":103,"sourceCode":"\n        if outfile_prefix is None:\n            self.tmp_dir = tempfile.TemporaryDirectory()\n            self.outfile_prefix = osp.join(self.tmp_dir.name, 'results')\n        else:\n            # the directory to save predicted panoptic segmentation mask\n            self.outfile_prefix = osp.join(outfile_prefix, 'results')  # type: ignore # yapf: disable # noqa: E501\n\n        dir_name = osp.expanduser(self.outfile_prefix)\n\n        if osp.exists(dir_name) and is_main_process():\n            logger: MMLogger = MMLogger.get_current_instance()\n            logger.info('remove previous results.')\n            shutil.rmtree(dir_name)\n        os.makedirs(dir_name, exist_ok=True)\n\n        self.backend_args = backend_args\n        if file_client_args is not None:\n            raise RuntimeError(\n                'The `file_client_args` is deprecated, '\n                'please use `backend_args` instead, please refer to'\n                'https://github.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection.py'  # noqa: E501\n            )\n\n        self.seg_prefix = seg_prefix\n        self.dump_matches = dump_matches\n\n    def __del__(self) -> None:\n        \"\"\"Clean up the results if necessary.\"\"\"\n        if self.tmp_dir is not None:\n            self.tmp_dir.cleanup()\n\n    # TODO: data_batch is no longer needed, consider adjusting the\n    #  parameter position\n    def process(self, data_batch: dict, data_samples: Sequence[dict]) -> None:\n        \"\"\"Process one batch of data samples and predictions. The processed\n        results should be stored in ``self.results``, which will be used to","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/metrics/cityscapes_metric.py#L85-L121","documentation":"CityscapesMetric dropped file_client_args in favor of backend_args (mmengine file backends). Passing the removed kwarg raises RuntimeError pointing to the migration example in the mmdetection configs.","triggerScenarios":"Constructing CityscapesMetric(..., file_client_args={...}) in old configs or custom code after upgrading mmdet/mmdetection.","commonSituations":"Configs written for mmdet 2.x ported to 3.x; tutorials referencing the old file client API.","solutions":["Remove file_client_args and pass backend_args=None or a backend dict","For cloud storage, set backend_args={'backend':'petrel','path_mapping':{...}} per the referenced config example","Grep configs for file_client_args and migrate all occurrences"],"exampleFix":"# before\nmetric = CityscapesMetric(file_client_args={'backend':'disk'})\n# after\nmetric = CityscapesMetric(backend_args=None)","handlingStrategy":"validation","validationCode":"assert 'file_client_args' not in kwargs, 'use backend_args, not file_client_args'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Grep and migrate file_client_args -> backend_args across configs on upgrade","Follow the referenced coco_detection.py config example for cloud backends"],"tags":["deprecation","file-client","mmdetection","migration"],"backgroundTag":"deprecated-argument","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}