{"record":{"id":"58d4c31b8ab97e59","repo":"run-llama/llama_index","slug":"unknown-mode-response-mode","errorCode":null,"errorMessage":"Unknown mode: {response_mode}","messagePattern":"Unknown mode: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/response_synthesizers/factory.py","lineNumber":198,"sourceCode":"            output_cls=output_cls,\n            streaming=streaming,\n            use_async=use_async,\n            multimodal=multimodal,\n        )\n    elif response_mode == ResponseMode.NO_TEXT:\n        return NoText(\n            callback_manager=callback_manager,\n            streaming=streaming,\n            multimodal=multimodal,\n        )\n    elif response_mode == ResponseMode.CONTEXT_ONLY:\n        return ContextOnly(\n            callback_manager=callback_manager,\n            streaming=streaming,\n            multimodal=multimodal,\n        )\n    else:\n        raise ValueError(f\"Unknown mode: {response_mode}\")\n","sourceCodeStart":180,"sourceCodeEnd":199,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/response_synthesizers/factory.py#L180-L199","documentation":"get_response_synthesizer's factory if/elif chain handles each ResponseMode enum value (COMPACT, TREE_SUMMARIZE, REFINE, SIMPLE_SUMMARIZE, NO_TEXT, CONTEXT_ONLY) and raises ValueError on any other value. The check compares against enum members, so both unknown strings and mistyped/renamed modes land here.","triggerScenarios":"Passing response_mode as a raw string with a typo ('refnie', 'tree_sumarize'); passing a mode that does not exist in this version ('accumulate' via this factory path where unsupported, or a mode name from newer/older docs); passing an arbitrary string not in ResponseMode.","commonSituations":"Mode names copied from tutorials of a different llama-index version; config files/CLI flags feeding unchecked strings into as_query_engine(response_mode=...); string constants that drifted from the enum (e.g. 'context_only' vs 'contextonly').","solutions":["Use the enum instead of a string: from llama_index.core.response_synthesizers.type import ResponseMode; response_mode=ResponseMode.COMPACT.","If using strings, copy the exact member values: 'compact', 'tree_summarize', 'refine', 'simple_summarize', 'no_text', 'context_only'.","Validate incoming config against ResponseMode before building the engine: assert mode in [m.value for m in ResponseMode]."],"exampleFix":"# before\nengine = index.as_query_engine(response_mode=\"tree_sumarize\")  # typo\n\n# after\nengine = index.as_query_engine(response_mode=\"tree_summarize\")\n# or\nfrom llama_index.core.response_synthesizers.type import ResponseMode\nengine = index.as_query_engine(response_mode=ResponseMode.TREE_SUMMARIZE)","handlingStrategy":"validation","validationCode":"from llama_index.core.response_synthesizers.type import ResponseMode\nassert response_mode in [m.value for m in ResponseMode], f\"bad mode: {response_mode}\"","typeGuard":"from llama_index.core.response_synthesizers.type import ResponseMode\n\ndef is_valid_response_mode(mode) -> bool:\n    return mode in ResponseMode or mode in [m.value for m in ResponseMode]","tryCatchPattern":null,"preventionTips":["Pass ResponseMode enum members instead of strings.","Validate mode strings from config against the enum before engine construction."],"tags":["response-synthesizer","configuration","enum","factory"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}