{"record":{"id":"8b1bbd1e665b24ad","repo":"run-llama/llama_index","slug":"module-module-name-not-found","errorCode":null,"errorMessage":"Module {module_name} not found.","messagePattern":"Module (.+?) not found\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/prompts/mixin.py","lineNumber":77,"sourceCode":"\n        \"\"\"\n        prompt_modules = self._get_prompt_modules()\n\n        # update prompts for current module\n        self._update_prompts(prompts_dict)\n\n        # get sub-module keys\n        # mapping from module name to sub-module prompt keys\n        sub_prompt_dicts: Dict[str, PromptDictType] = defaultdict(dict)\n        for key in prompts_dict:\n            if \":\" in key:\n                module_name, sub_key = key.split(\":\")\n                sub_prompt_dicts[module_name][sub_key] = prompts_dict[key]\n\n        # now update prompts for submodules\n        for module_name, sub_prompt_dict in sub_prompt_dicts.items():\n            if module_name not in prompt_modules:\n                raise ValueError(f\"Module {module_name} not found.\")\n            module = prompt_modules[module_name]\n            module.update_prompts(sub_prompt_dict)\n\n    @abstractmethod\n    def _get_prompts(self) -> PromptDictType:\n        \"\"\"Get prompts.\"\"\"\n\n    @abstractmethod\n    def _get_prompt_modules(self) -> PromptMixinType:\n        \"\"\"\n        Get prompt sub-modules.\n\n        Return a dictionary of sub-modules within the current module\n        that also implement PromptMixin (so that their prompts can also be get/set).\n\n        Can be blank if no sub-modules.\n\n        \"\"\"","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/prompts/mixin.py#L59-L95","documentation":"PromptMixin.update_prompts() splits any ':'-containing key you pass into (module_name, sub_key) and routes the new prompt to the matching entry in _get_prompt_modules(). If the prefix before ':' does not match any registered module name, it raises ValueError(f\"Module {module_name} not found.\") — the update cannot be routed.","triggerScenarios":"Calling engine.update_prompts({'retriver:text_qa_template': tpl}) (typo in module name), or using a module prefix that exists on a different class than the one you're updating, or updating before sub-modules are attached. Any key without ':' is treated as a local prompt key and never triggers this; only prefixed keys do.","commonSituations":"Copy-pasting update_prompts() snippets from docs of a different engine whose module names differ ('response_synthesizer' vs 'synthesizer'), typos in long flattened keys taken from a get_prompts() dump of another object, version upgrades that renamed internal modules.","solutions":["Call engine.get_prompts() first and copy the exact flattened keys it prints; pass only those keys to update_prompts().","Fix the typo in the module prefix so it matches a key in engine._get_prompt_modules() exactly (case-sensitive).","If the target prompt lives on a sub-object you already hold a reference to, update it there directly: engine.response_synthesizer.update_prompts({'text_qa_template': tpl}).","Diff against the llama-index version's source (or get_prompts() output) after upgrading — module names occasionally change between releases."],"exampleFix":"# before\nengine.update_prompts({\n    \"retriver:text_qa_template\": new_tpl,  # typo: module 'retriver' unknown\n})\n\n# after\nprint(engine.get_prompts().keys())          # shows 'response_synthesizer:text_qa_template'\nengine.update_prompts({\n    \"response_synthesizer:text_qa_template\": new_tpl,\n})","handlingStrategy":"validation","validationCode":"def safe_update_prompts(engine, new_prompts: dict) -> None:\n    known = set(engine.get_prompts().keys())\n    unknown = [k for k in new_prompts if k not in known]\n    if unknown:\n        raise KeyError(\n            f\"unknown prompt keys {unknown}; available keys: {sorted(known)}\"\n        )\n    engine.update_prompts(new_prompts)\n\nsafe_update_prompts(engine, {\"response_synthesizer:text_qa_template\": tpl})","typeGuard":"def is_valid_prompt_update(engine, new_prompts: dict) -> bool:\n    return set(new_prompts) <= set(engine.get_prompts().keys())","tryCatchPattern":null,"preventionTips":["Always derive update keys from engine.get_prompts() output rather than typing them by hand.","Module prefixes are case-sensitive and version-dependent — re-dump keys after upgrading llama-index.","When updating many prompts, validate the whole key set against get_prompts() in one pre-flight check."],"tags":["llama-index","prompts","prompt-mixin","update-prompts","naming"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}