{"record":{"id":"4c916f119269e2f6","repo":"open-mmlab/mmdetection","slug":"the-file-client-args-is-deprecated-please-use-4c916f","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":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mmdet/evaluation/metrics/coco_panoptic_metric.py","lineNumber":115,"sourceCode":"\n        self.tmp_dir = None\n        # outfile_prefix should be a prefix of a path which points to a shared\n        # storage when train or test with multi nodes.\n        self.outfile_prefix = outfile_prefix\n        if outfile_prefix is None:\n            self.tmp_dir = tempfile.TemporaryDirectory()\n            self.outfile_prefix = osp.join(self.tmp_dir.name, 'results')\n        # the directory to save predicted panoptic segmentation mask\n        self.seg_out_dir = f'{self.outfile_prefix}.panoptic'\n        self.nproc = nproc\n        self.seg_prefix = seg_prefix\n\n        self.cat_ids = None\n        self.cat2label = None\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        if ann_file:\n            with get_local_path(\n                    ann_file, backend_args=self.backend_args) as local_path:\n                self._coco_api = COCOPanoptic(local_path)\n            self.categories = self._coco_api.cats\n        else:\n            self._coco_api = None\n            self.categories = None\n\n    def __del__(self) -> None:\n        \"\"\"Clean up.\"\"\"\n        if self.tmp_dir is not None:\n            self.tmp_dir.cleanup()","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/metrics/coco_panoptic_metric.py#L97-L133","documentation":"CocoPanopticMetric.__init__ rejects the deprecated `file_client_args` argument; like CocoMetric, file access must be configured through `backend_args` (mmengine fileio backends) in mmdetection 3.x. Passing the old parameter raises RuntimeError immediately with a pointer to the reference config. This is a deliberate hard break of the legacy file-client API.","triggerScenarios":"Calling CocoPanopticMetric(..., file_client_args={...}) or a panoptic test config that still has file_client_args in its evaluator dict after upgrading mmdet.","commonSituations":"Migrating 2.x-era panoptic configs; custom evaluators subclassing CocoPanopticMetric that forward old kwargs; configs copied from projects using ceph/petl via file_client_args.","solutions":["Delete file_client_args and set backend_args (e.g. dict(backend='local') or dict(backend='petrel', path_mapping={...}))","Update subclass __init__ signatures to accept backend_args only","Compare against configs/_base_/datasets/coco_detection.py for the new style"],"exampleFix":"# before\ntest_evaluator = dict(type='CocoPanopticMetric', file_client_args=dict(backend='disk'))\n# after\ntest_evaluator = dict(type='CocoPanopticMetric', backend_args=dict(backend='local'))","handlingStrategy":"validation","validationCode":"for key in ('val_evaluator','test_evaluator'):\n    if key in cfg and 'file_client_args' in cfg[key]:\n        raise ValueError(f'{key}: file_client_args deprecated; use backend_args')","typeGuard":"def evaluator_cfg_is_v3(eval_cfg: dict) -> bool:\n    return isinstance(eval_cfg, dict) and 'file_client_args' not in eval_cfg","tryCatchPattern":null,"preventionTips":["Automated config checks rejecting file_client_args in CI","Keep one canonical backend_args snippet and reuse it","For petrel/s3 backends, also migrate path_mapping into backend_args"],"tags":["mmdetection","deprecation","panoptic-segmentation","migration"],"backgroundTag":"deprecated-parameter-removed","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}