opendatalab/MinerU · error · InvalidParams

bucket name: {bucket_name} not found in s3_configs: {self.s3

Error message

bucket name: {bucket_name} not found in s3_configs: {self.s3_configs}

What it means

InvalidParams raised by MultiBucketS3DataReader.__get_s3_client when the bucket of a path being read is not present in self.s3_configs. The reader selects a per-bucket client from the configured credential list; an unconfigured bucket has no credentials and is rejected before any S3 request is made.

Source

Thrown at mineru/data/data_reader_writer/multi_bucket_s3.py:84

        Args:
            path (str): the s3 path of file, the path must be in the format of s3://bucket_name/path?offset,limit.
            for example: s3://bucket_name/path?0,100.

        Returns:
            bytes: the content of s3 file.
        """
        may_range_params = parse_s3_range_params(path)
        if may_range_params is None or 2 != len(may_range_params):
            byte_start, byte_len = 0, -1
        else:
            byte_start, byte_len = int(may_range_params[0]), int(may_range_params[1])
        path = remove_non_official_s3_args(path)
        return self.read_at(path, byte_start, byte_len)

    def __get_s3_client(self, bucket_name: str):
        if bucket_name not in set([conf.bucket_name for conf in self.s3_configs]):
            raise InvalidParams(
                f'bucket name: {bucket_name} not found in s3_configs: {self.s3_configs}'
            )
        if bucket_name not in self._s3_clients_h:
            conf = next(
                filter(lambda conf: conf.bucket_name == bucket_name, self.s3_configs)
            )
            S3Reader, _ = _load_s3_io_classes()
            self._s3_clients_h[bucket_name] = S3Reader(
                bucket_name,
                conf.access_key,
                conf.secret_key,
                conf.endpoint_url,
                conf.addressing_style,
            )
        return self._s3_clients_h[bucket_name]

    def read_at(self, path: str, offset: int = 0, limit: int = -1) -> bytes:
        """Read the file with offset and limit, select diffect bucket client

View on GitHub (pinned to 4fe4bde114)

Solutions

  1. Add an S3Config for the bucket named in the failing s3:// URL (the error message lists every configured bucket).
  2. Rewrite the path to the bucket you did configure, or make it relative so the default bucket is used.
  3. Pre-scan input paths and extract the set of buckets via parse_s3path() to verify coverage before processing.

Example fix

# before
configs = [S3Config(bucket_name='docs', ...)]
reader = MultiBucketS3DataReader('docs/', configs)
reader.read('s3://invoices/q1.pdf')  # InvalidParams

# after
configs = [
    S3Config(bucket_name='docs', ...),
    S3Config(bucket_name='invoices', ...),
]
reader = MultiBucketS3DataReader('docs/', configs)
reader.read('s3://invoices/q1.pdf')
Defensive patterns

Strategy: validation

Validate before calling

from mineru.data.utils.path_utils import parse_s3path

def check_bucket_coverage(paths: list[str], reader) -> None:
    known = {c.bucket_name for c in reader.s3_configs}
    missing = {parse_s3path(p)[0] for p in paths if p.startswith(('s3://', 's3a://'))} - known
    if missing:
        raise ValueError(f'no S3Config for buckets: {sorted(missing)}')

Try / catch

from mineru.data.utils.exceptions import InvalidParams

try:
    data = reader.read(path)
except InvalidParams as e:
    if 'not found in s3_configs' in e.msg:
        # add config for the bucket named in e.msg, then retry once
        raise
    raise

Prevention

When it happens

Trigger: reader.read('s3://other-bucket/file.pdf') where 'other-bucket' has no S3Config entry — happens for absolute s3:// paths, since read_at() parses the bucket via parse_s3path(); relative paths always use default_bucket, which was validated at construction.

Common situations: A document list contains URLs pointing at several buckets but s3_configs only covers one; cross-bucket migration where input paths moved to a new bucket; hardcoded s3:// URLs in test fixtures referencing a bucket never registered.

Related errors


AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14). Data as JSON: /api/errors/e6569e567e38a9f9. Report an issue: GitHub.