{"record":{"id":"a26152db4e8d8320","repo":"chroma-core/chroma","slug":"missing-required-config-value-key","errorCode":null,"errorMessage":"Missing required config value '{key}'","messagePattern":"Missing required config value '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/config.py","lineNumber":310,"sourceCode":"    # ======\n    # Legacy\n    # ======\n\n    chroma_db_impl: Optional[str] = None\n    chroma_collection_assignment_policy_impl: str = (\n        \"chromadb.ingest.impl.simple_policy.SimpleAssignmentPolicy\"\n    )\n\n    # =======\n    # Methods\n    # =======\n\n    def require(self, key: str) -> Any:\n        \"\"\"Return the value of a required config key, or raise an exception if it is not\n        set\"\"\"\n        val = self[key]\n        if val is None:\n            raise ValueError(f\"Missing required config value '{key}'\")\n        return val\n\n    def __getitem__(self, key: str) -> Any:\n        val = getattr(self, key)\n        # Error on legacy config values\n        if isinstance(val, str) and val in _legacy_config_values:\n            raise ValueError(LEGACY_ERROR)\n        return val\n\n    model_config = {\"env_file\": \".env\", \"env_file_encoding\": \"utf-8\", \"extra\": \"ignore\"}\n\n\nT = TypeVar(\"T\", bound=\"Component\")\n\n\nclass Component(ABC, EnforceOverrides):\n    _dependencies: Set[\"Component\"]\n    _system: \"System\"","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/config.py#L292-L328","documentation":"Settings.require(key) (chromadb/config.py) is the accessor for settings that must be present - it reads the key and raises ValueError if the value is None. A None means no default exists for that field and nothing supplied it: not the Settings(...) call, not a .env file, not an environment variable. Internal components (e.g. SqliteDB requiring allow_reset, MigratableDB requiring migrations_hash_algorithm) call require() during startup, so this typically fires while a System boots.","triggerScenarios":"Booting a System whose Settings never set a required, default-less key; a misspelled or missing CHROMA_-prefixed env var; a .env file not loaded because the process runs from a different working directory (model_config env_file='.env' is relative); passing Settings() bare in a custom deployment.","commonSituations":"Custom deployment code that constructs System(Settings()) without setting impl-level keys; env var naming/casing mismatches in Docker or CI; running the app from another directory so the relative .env is not found.","solutions":["Set the value explicitly in the constructor: Settings(migrations_hash_algorithm='sha256') (use whichever key the traceback names).","Export the matching CHROMA_-prefixed environment variable (e.g. CHROMA_MIGRATIONS_HASH_ALGORITHM).","If the setting is genuinely optional in your flow, read it with settings[key] and handle None yourself instead of require()."],"exampleFix":"// before\nsettings = Settings(persist_directory='./data')  # migrations_hash_algorithm is None\n...\nsettings.require('migrations_hash_algorithm')  # ValueError\n\n// after\nsettings = Settings(persist_directory='./data', migrations_hash_algorithm='sha256')\nsettings.require('migrations_hash_algorithm')","handlingStrategy":"validation","validationCode":"key = 'migrations_hash_algorithm'  # whichever key you require\nif settings[key] is None:\n    settings = settings.model_copy(update={key: 'sha256'})  # supply a default explicitly\nsettings.require(key)","typeGuard":null,"tryCatchPattern":"try:\n    val = settings.require(key)\nexcept ValueError as e:\n    raise RuntimeError(\n        f'config error: {e}. Set Settings({key}=...) or export the matching CHROMA_ env var.'\n    ) from e","preventionTips":["Build Settings in one factory function per environment so required keys are never missed.","At startup, assert every key you will require() is non-None and fail with a clear message.","Run the process from the directory containing .env, or pass an absolute env_file path."],"tags":["configuration","settings","env-vars"],"backgroundTag":"missing-config-value","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}