open-mmlab/mmdetection · error · RuntimeError

The `file_client_args` is deprecated, please use `backend_ar

Error message

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

What it means

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.

Source

Thrown at mmdet/evaluation/metrics/dump_proposals_metric.py:53

            will be used instead. Defaults to None.
    """

    default_prefix: Optional[str] = 'dump_proposals'

    def __init__(self,
                 output_dir: str = '',
                 proposals_file: str = 'proposals.pkl',
                 num_max_proposals: Optional[int] = None,
                 file_client_args: dict = None,
                 backend_args: dict = None,
                 collect_device: str = 'cpu',
                 prefix: Optional[str] = None) -> None:
        super().__init__(collect_device=collect_device, prefix=prefix)
        self.num_max_proposals = num_max_proposals
        # TODO: update after mmengine finish refactor fileio.
        self.backend_args = backend_args
        if file_client_args is not None:
            raise RuntimeError(
                'The `file_client_args` is deprecated, '
                'please use `backend_args` instead, please refer to'
                'https://github.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection.py'  # noqa: E501
            )
        self.output_dir = output_dir
        assert proposals_file.endswith(('.pkl', '.pickle')), \
            'The output file must be a pkl file.'

        self.proposals_file = os.path.join(self.output_dir, proposals_file)
        if is_main_process():
            os.makedirs(self.output_dir, exist_ok=True)

    def process(self, data_batch: Sequence[dict],
                data_samples: Sequence[dict]) -> None:
        """Process one batch of data samples and predictions. The processed
        results should be stored in ``self.results``, which will be used to
        compute the metrics when all batches have been processed.

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Remove `file_client_args` from the evaluator config and use `backend_args=dict(backend='disk')` (or omit it entirely for local disk)
  2. Follow the migration example at the URL in the message: configs/_base_/datasets/coco_detection.py in the mmdetection repo
  3. Run mmengine's config migration tool (`python tools/model_converters/upgrade_config.py` or the official config migration script) on legacy configs

Example fix

// before
val_evaluator=dict(type='DumpProposals', file_client_args=dict(backend='disk'))
// after
val_evaluator=dict(type='DumpProposals', backend_args=dict(backend='disk'))
Defensive patterns

Strategy: validation

Validate before calling

from mmdet.evaluation import DumpProposalsMetric
import inspect
params = inspect.signature(DumpProposalsMetric.__init__).parameters
assert 'file_client_args' not in cfg_evaluator or cfg_evaluator['file_client_args'] is None, \
    'file_client_args is removed in mmdet 3.x; use backend_args'

Type guard

def has_legacy_file_client_args(cfg: dict) -> bool:
    return cfg.get('file_client_args') is not None

Try / catch

try:
    metric = DumpProposalsMetric(**evaluator_cfg)
except RuntimeError as e:
    if 'file_client_args' in str(e):
        evaluator_cfg.pop('file_client_args', None)
        evaluator_cfg.setdefault('backend_args', {'backend': 'disk'})
        metric = DumpProposalsMetric(**evaluator_cfg)
    else:
        raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27). Data as JSON: /api/errors/248a4872f0e62d8d. Report an issue: GitHub.