{"record":{"id":"5b2d751fd1d94ced","repo":"VectifyAI/PageIndex","slug":"unknown-config-keys-unknown-keys","errorCode":null,"errorMessage":"Unknown config keys: {unknown_keys}","messagePattern":"Unknown config keys: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pageindex/utils.py","lineNumber":1082,"sourceCode":"                  chat_model=chat, retrieve_model=chat)\n\n\nclass ConfigLoader:\n    def __init__(self, default_path: str = None):\n        if default_path is None:\n            default_path = Path(__file__).parent / \"config.yaml\"\n        self._default_dict = self._load_yaml(default_path)\n\n    @staticmethod\n    def _load_yaml(path):\n        with open(path, \"r\", encoding=\"utf-8\") as f:\n            return yaml.safe_load(f) or {}\n\n    def _validate_keys(self, user_dict):\n        unknown_keys = (set(user_dict) - set(self._default_dict)\n                        - set(_MODEL_KEYS))\n        if unknown_keys:\n            raise ValueError(f\"Unknown config keys: {unknown_keys}\")\n\n    def load(self, user_opt=None) -> config:\n        \"\"\"\n        Load the configuration, merging user options with default values.\n        \"\"\"\n        if user_opt is None:\n            user_dict = {}\n        elif isinstance(user_opt, config):\n            user_dict = vars(user_opt)\n        elif isinstance(user_opt, dict):\n            user_dict = user_opt\n        else:\n            raise TypeError(\"user_opt must be dict, config(SimpleNamespace) or None\")\n\n        self._validate_keys(user_dict)\n        merged = {**self._default_dict, **user_dict}\n        _resolve_models(merged)\n        return config(**merged)","sourceCodeStart":1064,"sourceCodeEnd":1100,"githubUrl":"https://github.com/VectifyAI/PageIndex/blob/afb5e119766630af6014b04fe8b53357527bc05e/pageindex/utils.py#L1064-L1100","documentation":"The config loader validates user-supplied keys against the known defaults plus _MODEL_KEYS and rejects anything unknown, to catch typos before they silently do nothing.","triggerScenarios":"Calling config load (e.g. ConfigDict.load(user_opt)) with a dict containing a misspelled or outdated key, such as 'summary_model_typo', 'optimise', or a key removed in a newer version.","commonSituations":"Upgrading the library and using old config keys, copy-pasting example config from incompatible docs, or misspelled YAML options.","solutions":["Read the error: it prints the exact unknown key set — fix or remove those keys","Compare against the default config dict / current docs for valid key names","Pin or migrate config files when upgrading library versions"],"exampleFix":"# before\nload({'summary_model': 'gpt-4o', 'summary_modeel': 'gpt-4o'})\n# after\nload({'summary_model': 'gpt-4o'})","handlingStrategy":"validation","validationCode":"KNOWN = set(default_config_dict) | set(_MODEL_KEYS)\nunknown = set(user_cfg) - KNOWN\nif unknown:\n    raise ValueError(f'fix config first: {unknown}')\nresult = load(user_cfg)","typeGuard":"def has_only_known_keys(cfg: dict, known: set) -> bool:\n    return isinstance(cfg, dict) and set(cfg) <= known","tryCatchPattern":"try:\n    cfg = load(user_cfg)\nexcept ValueError as e:\n    if 'Unknown config keys' in str(e):\n        bad = ast.literal_eval(str(e).split(': ', 1)[1])\n        cfg = load({k: v for k, v in user_cfg.items() if k not in bad})\n    else:\n        raise","preventionTips":["Validate config against the library defaults at startup in CI","Treat unknown-key errors as build failures in config-driven pipelines","Re-check config keys on every library version bump"],"tags":["config","validation","unknown-key","typo"],"backgroundTag":"unknown-config-key","analyzedSha":"afb5e119766630af6014b04fe8b53357527bc05e","analyzedAt":"2026-08-27T11:20:48.519Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}