{"record":{"id":"e6569e567e38a9f9","repo":"opendatalab/MinerU","slug":"bucket-name-bucket-name-not-found-in-s3-configs","errorCode":null,"errorMessage":"bucket name: {bucket_name} not found in s3_configs: {self.s3_configs}","messagePattern":"bucket name: (.+?) not found in s3_configs: (.+?)","errorType":"validation","errorClass":"InvalidParams","httpStatus":null,"severity":"error","filePath":"mineru/data/data_reader_writer/multi_bucket_s3.py","lineNumber":84,"sourceCode":"\n        Args:\n            path (str): the s3 path of file, the path must be in the format of s3://bucket_name/path?offset,limit.\n            for example: s3://bucket_name/path?0,100.\n\n        Returns:\n            bytes: the content of s3 file.\n        \"\"\"\n        may_range_params = parse_s3_range_params(path)\n        if may_range_params is None or 2 != len(may_range_params):\n            byte_start, byte_len = 0, -1\n        else:\n            byte_start, byte_len = int(may_range_params[0]), int(may_range_params[1])\n        path = remove_non_official_s3_args(path)\n        return self.read_at(path, byte_start, byte_len)\n\n    def __get_s3_client(self, bucket_name: str):\n        if bucket_name not in set([conf.bucket_name for conf in self.s3_configs]):\n            raise InvalidParams(\n                f'bucket name: {bucket_name} not found in s3_configs: {self.s3_configs}'\n            )\n        if bucket_name not in self._s3_clients_h:\n            conf = next(\n                filter(lambda conf: conf.bucket_name == bucket_name, self.s3_configs)\n            )\n            S3Reader, _ = _load_s3_io_classes()\n            self._s3_clients_h[bucket_name] = S3Reader(\n                bucket_name,\n                conf.access_key,\n                conf.secret_key,\n                conf.endpoint_url,\n                conf.addressing_style,\n            )\n        return self._s3_clients_h[bucket_name]\n\n    def read_at(self, path: str, offset: int = 0, limit: int = -1) -> bytes:\n        \"\"\"Read the file with offset and limit, select diffect bucket client","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/data/data_reader_writer/multi_bucket_s3.py#L66-L102","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add an S3Config for the bucket named in the failing s3:// URL (the error message lists every configured bucket).","Rewrite the path to the bucket you did configure, or make it relative so the default bucket is used.","Pre-scan input paths and extract the set of buckets via parse_s3path() to verify coverage before processing."],"exampleFix":"# before\nconfigs = [S3Config(bucket_name='docs', ...)]\nreader = MultiBucketS3DataReader('docs/', configs)\nreader.read('s3://invoices/q1.pdf')  # InvalidParams\n\n# after\nconfigs = [\n    S3Config(bucket_name='docs', ...),\n    S3Config(bucket_name='invoices', ...),\n]\nreader = MultiBucketS3DataReader('docs/', configs)\nreader.read('s3://invoices/q1.pdf')","handlingStrategy":"validation","validationCode":"from mineru.data.utils.path_utils import parse_s3path\n\ndef check_bucket_coverage(paths: list[str], reader) -> None:\n    known = {c.bucket_name for c in reader.s3_configs}\n    missing = {parse_s3path(p)[0] for p in paths if p.startswith(('s3://', 's3a://'))} - known\n    if missing:\n        raise ValueError(f'no S3Config for buckets: {sorted(missing)}')","typeGuard":null,"tryCatchPattern":"from mineru.data.utils.exceptions import InvalidParams\n\ntry:\n    data = reader.read(path)\nexcept InvalidParams as e:\n    if 'not found in s3_configs' in e.msg:\n        # add config for the bucket named in e.msg, then retry once\n        raise\n    raise","preventionTips":["Pre-scan all s3:// input paths and register every referenced bucket in s3_configs.","Prefer relative paths when data lives under default_bucket/default_prefix.","Fail fast at pipeline setup with a bucket-coverage check instead of mid-run."],"tags":["s3","config","validation","reader"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}