{"record":{"id":"074d5bc2b9ca6b1b","repo":"cocoindex-io/cocoindex","slug":"specify-either-db-settings-or-the-legacy-lmdb","errorCode":null,"errorMessage":"Specify either `db_settings=` or the legacy `lmdb_max_dbs=`/`lmdb_map_size=` keyword arguments, not both.","messagePattern":"Specify either `db_settings=` or the legacy `lmdb_max_dbs=`/`lmdb_map_size=` keyword arguments, not both\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/_internal/setting.py","lineNumber":80,"sourceCode":"    db_path: os.PathLike[str] | None\n    db_settings: LmdbSettings\n    # Deprecated v0 leftover; has no effect in v1. Kept (always `None`) so callers\n    # that still pass `global_execution_options=None` don't break.\n    global_execution_options: None\n\n    def __init__(\n        self,\n        db_path: os.PathLike[str] | None = None,\n        db_settings: LmdbSettings | None = None,\n        *,\n        lmdb_max_dbs: int | None = None,\n        lmdb_map_size: int | None = None,\n        global_execution_options: None = None,  # Deprecated; ignored.\n    ) -> None:\n        if db_settings is not None and (\n            lmdb_max_dbs is not None or lmdb_map_size is not None\n        ):\n            raise ValueError(\n                \"Specify either `db_settings=` or the legacy \"\n                \"`lmdb_max_dbs=`/`lmdb_map_size=` keyword arguments, not both.\"\n            )\n        if db_settings is None:\n            db_settings = LmdbSettings()\n            if lmdb_max_dbs is not None:\n                db_settings.max_dbs = lmdb_max_dbs\n            if lmdb_map_size is not None:\n                db_settings.map_size = lmdb_map_size\n\n        self.db_path = db_path\n        self.db_settings = db_settings\n        self.global_execution_options = None\n\n    @property\n    def lmdb_max_dbs(self) -> int:\n        return self.db_settings.max_dbs\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/_internal/setting.py#L62-L98","documentation":"Settings.__init__ rejects passing the new db_settings= object together with the legacy lmdb_max_dbs=/lmdb_map_size= keyword arguments, since the two mechanisms configure the same LMDB storage and are mutually exclusive. The legacy kwargs are kept only for backward compatibility.","triggerScenarios":"Constructing Settings(db_settings=LmdbSettings(...), lmdb_max_dbs=N) or Settings(db_settings=..., lmdb_map_size=...) — any combination where db_settings is not None and either legacy kwarg is not None.","commonSituations":"Migrating code from the legacy kwargs to db_settings and leaving both in place; copying examples from old docs plus new docs; scaffolding tools that emit both forms.","solutions":["Remove the legacy lmdb_max_dbs=/lmdb_map_size= kwargs and keep only db_settings=","Or drop db_settings= and configure solely via the legacy kwargs if on old code","Express the legacy values inside LmdbSettings(max_dbs=..., map_size=...) when consolidating"],"exampleFix":"// before\nSettings(db_settings=LmdbSettings(map_size=1 << 40), lmdb_max_dbs=64)\n// after\nSettings(db_settings=LmdbSettings(max_dbs=64, map_size=1 << 40))","handlingStrategy":"validation","validationCode":"def build_settings(db_settings=None, lmdb_max_dbs=None, lmdb_map_size=None):\n    assert not (db_settings is not None and (lmdb_max_dbs is not None or lmdb_map_size is not None))\n    return Settings(db_settings=db_settings, lmdb_max_dbs=lmdb_max_dbs, lmdb_map_size=lmdb_map_size)","typeGuard":null,"tryCatchPattern":"try:\n    settings = Settings(db_settings=..., lmdb_max_dbs=...)\nexcept ValueError as e:\n    settings = Settings(db_settings=LmdbSettings(max_dbs=..., map_size=...))","preventionTips":["After migrating to db_settings=, delete all legacy kwargs","Centralize Settings construction in one factory function","Grep codebase for lmdb_max_dbs/lmdb_map_size when touching settings"],"tags":["configuration","api-migration","arguments"],"backgroundTag":"conflicting-config-options","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}