{"record":{"id":"f3b7d660055273ac","repo":"open-mmlab/mmdetection","slug":"the-file-client-args-is-deprecated-please-use","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/datasets/base_det_dataset.py","lineNumber":46,"sourceCode":"    def __init__(self,\n                 *args,\n                 seg_map_suffix: str = '.png',\n                 proposal_file: Optional[str] = None,\n                 file_client_args: dict = None,\n                 backend_args: dict = None,\n                 return_classes: bool = False,\n                 caption_prompt: Optional[dict] = None,\n                 **kwargs) -> None:\n        self.seg_map_suffix = seg_map_suffix\n        self.proposal_file = proposal_file\n        self.backend_args = backend_args\n        self.return_classes = return_classes\n        self.caption_prompt = caption_prompt\n        if self.caption_prompt is not None:\n            assert self.return_classes, \\\n                'return_classes must be True when using caption_prompt'\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        super().__init__(*args, **kwargs)\n\n    def full_init(self) -> None:\n        \"\"\"Load annotation file and set ``BaseDataset._fully_initialized`` to\n        True.\n\n        If ``lazy_init=False``, ``full_init`` will be called during the\n        instantiation and ``self._fully_initialized`` will be set to True. If\n        ``obj._fully_initialized=False``, the class method decorated by\n        ``force_full_init`` will call ``full_init`` automatically.\n\n        Several steps to initialize annotation:\n\n            - load_data_list: Load annotations from annotation file.","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/datasets/base_det_dataset.py#L28-L64","documentation":"BaseDetDataset (all mmdet detection datasets) removed support for file_client_args in the MMEngine migration; passing it now raises a RuntimeError pointing at backend_args. File client behavior (disk/ceph/http backends) is configured through backend_args (mmengine.fileio) instead. This is a hard deprecation, not a warning.","triggerScenarios":"Instantiating any mmdet dataset class (or building a dataloader from a config) whose init kwargs include file_client_args — typically configs carried over from mmdet 2.x or from older projects.","commonSituations":"Upgrading mmdet 2.x configs to 3.x; copying dataset config blocks from old repos/tutorials that set file_client_args=dict(backend='disk'); internal clusters that used ceph via file_client_args.","solutions":["Delete the file_client_args entry from the dataset config (plain disk access needs no backend_args)","For non-local storage, set backend_args instead, e.g. backend_args=dict(backend='petrel', path_mapping=dict({'./data/': 's3://data/'}))","Use mmdet's config migration tool / follow configs/_base_/datasets/coco_detection.py in the current repo as the reference","After editing, re-parse the config with Config.fromfile to confirm no stale keys remain"],"exampleFix":"# before\ntrain_dataloader=dict(\n  dataset=dict(type='CocoDataset', data_root='data/', ann_file='train.json',\n               data_prefix=dict(img='train/'),\n               file_client_args=dict(backend='disk')))\n# after\ntrain_dataloader=dict(\n  dataset=dict(type='CocoDataset', data_root='data/', ann_file='train.json',\n               data_prefix=dict(img='train/')))\n# or for ceph:\n  # backend_args=dict(backend='petrel', path_mapping=dict({'./data/': 's3://bucket/data/'}))","handlingStrategy":"validation","validationCode":"cfg = Config.fromfile(config_path)\nfor name in ('train_dataloader', 'val_dataloader', 'test_dataloader'):\n    ds = cfg.get(name, {}).get('dataset', {})\n    if isinstance(ds, dict) and 'file_client_args' in ds:\n        ds.pop('file_client_args')  # or move to backend_args\ncfg.dump(config_path)","typeGuard":"def uses_deprecated_file_client(cfg) -> bool:\n    return any('file_client_args' in (cfg.get(n, {}).get('dataset') or {})\n               for n in ('train_dataloader', 'val_dataloader', 'test_dataloader'))","tryCatchPattern":"try:\n    runner = Runner.from_cfg(cfg)\nexcept RuntimeError as e:\n    if 'file_client_args' in str(e):\n        raise SystemExit('Remove file_client_args from dataset configs; use backend_args (see configs/_base_/datasets/coco_detection.py)')\n    raise","preventionTips":["After major-version upgrades, run the repo's config migration tooling over all configs","Grep configs for removed keys (file_client_args) in CI","Reference current configs/_base_/datasets/* files rather than old tutorials when setting up storage backends"],"tags":["mmdetection","dataset","deprecation","config-migration","backend-args"],"backgroundTag":"deprecated-argument-removed","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}