{"record":{"id":"248a4872f0e62d8d","repo":"open-mmlab/mmdetection","slug":"the-file-client-args-is-deprecated-please-use-248a48","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/dump_proposals_metric.py","lineNumber":53,"sourceCode":"            will be used instead. Defaults to None.\n    \"\"\"\n\n    default_prefix: Optional[str] = 'dump_proposals'\n\n    def __init__(self,\n                 output_dir: str = '',\n                 proposals_file: str = 'proposals.pkl',\n                 num_max_proposals: Optional[int] = None,\n                 file_client_args: dict = None,\n                 backend_args: dict = None,\n                 collect_device: str = 'cpu',\n                 prefix: Optional[str] = None) -> None:\n        super().__init__(collect_device=collect_device, prefix=prefix)\n        self.num_max_proposals = num_max_proposals\n        # TODO: update after mmengine finish refactor fileio.\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        self.output_dir = output_dir\n        assert proposals_file.endswith(('.pkl', '.pickle')), \\\n            'The output file must be a pkl file.'\n\n        self.proposals_file = os.path.join(self.output_dir, proposals_file)\n        if is_main_process():\n            os.makedirs(self.output_dir, exist_ok=True)\n\n    def process(self, data_batch: Sequence[dict],\n                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\n        compute the metrics when all batches have been processed.\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/metrics/dump_proposals_metric.py#L35-L71","documentation":"DumpProposalsMetric.__init__ raises RuntimeError when the deprecated `file_client_args` parameter is passed. mmdetection migrated its file I/O configuration from `file_client_args` to `backend_args` when it adopted mmengine's fileio backends, and old configs still carrying `file_client_args` are rejected outright with no fallback.","triggerScenarios":"Constructing DumpProposalsMetric (or a config with `val_evaluator=dict(type='DumpProposals', file_client_args={...})`) while passing a non-None `file_client_args` dict, typically in a proposal-dumping config (e.g. RPN proposal evaluation configs).","commonSituations":"Using an old mmdet v2.x config or third-party config with mmdet v3.x; copying a legacy `file_client_args=dict(backend='disk')` block into a DumpProposals evaluator; upgrading mmdetection without migrating configs.","solutions":["Remove `file_client_args` from the evaluator config and use `backend_args=dict(backend='disk')` (or omit it entirely for local disk)","Follow the migration example at the URL in the message: configs/_base_/datasets/coco_detection.py in the mmdetection repo","Run mmengine's config migration tool (`python tools/model_converters/upgrade_config.py` or the official config migration script) on legacy configs"],"exampleFix":"// before\nval_evaluator=dict(type='DumpProposals', file_client_args=dict(backend='disk'))\n// after\nval_evaluator=dict(type='DumpProposals', backend_args=dict(backend='disk'))","handlingStrategy":"validation","validationCode":"from mmdet.evaluation import DumpProposalsMetric\nimport inspect\nparams = inspect.signature(DumpProposalsMetric.__init__).parameters\nassert 'file_client_args' not in cfg_evaluator or cfg_evaluator['file_client_args'] is None, \\\n    'file_client_args is removed in mmdet 3.x; use backend_args'","typeGuard":"def has_legacy_file_client_args(cfg: dict) -> bool:\n    return cfg.get('file_client_args') is not None","tryCatchPattern":"try:\n    metric = DumpProposalsMetric(**evaluator_cfg)\nexcept RuntimeError as e:\n    if 'file_client_args' in str(e):\n        evaluator_cfg.pop('file_client_args', None)\n        evaluator_cfg.setdefault('backend_args', {'backend': 'disk'})\n        metric = DumpProposalsMetric(**evaluator_cfg)\n    else:\n        raise","preventionTips":["Never copy file_client_args from mmdet 2.x configs","Run configs through the official mmengine migration tool after upgrading mmdetection","Prefer omitting backend_args entirely for local-disk I/O"],"tags":["mmdetection","deprecation","config","fileio"],"backgroundTag":"deprecated-parameter-migration","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}