{"record":{"id":"7324b2a06ca36f14","repo":"microsoft/autogen","slug":"unknown-mode-self-mode","errorCode":null,"errorMessage":"\nUnknown mode: {self.mode}","messagePattern":"\nUnknown mode: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/experimental/task_centric_memory/utils/chat_completion_client_recorder.py","lineNumber":152,"sourceCode":"                raise ValueError(error_str)\n            self._record_index += 1\n            self._num_checked_records += 1\n\n            data = rec.get(\"response\")\n            # Populate a CreateResult from the data.\n            assert data is not None\n            result = CreateResult(\n                content=data.get(\"content\", \"\"),\n                finish_reason=data.get(\"finish_reason\", \"stop\"),\n                usage=data.get(\"usage\", RequestUsage(prompt_tokens=0, completion_tokens=0)),\n                cached=True,\n            )\n            return result\n\n        else:\n            error_str = f\"\\nUnknown mode: {self.mode}\"\n            self.logger.error(error_str)\n            raise ValueError(error_str)\n\n    def create_stream(\n        self,\n        messages: Sequence[LLMMessage],\n        *,\n        tools: Sequence[Tool | ToolSchema] = [],\n        json_output: Optional[bool | type[BaseModel]] = None,\n        extra_create_args: Mapping[str, Any] = {},\n        cancellation_token: Optional[CancellationToken] = None,\n        tool_choice: Tool | Literal[\"auto\", \"required\", \"none\"] = \"auto\",\n    ) -> AsyncGenerator[Union[str, CreateResult], None]:\n        return self.base_client.create_stream(\n            messages,\n            tools=tools,\n            tool_choice=tool_choice,\n            json_output=json_output,\n            extra_create_args=extra_create_args,\n            cancellation_token=cancellation_token,","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/experimental/task_centric_memory/utils/chat_completion_client_recorder.py#L134-L170","documentation":"ChatCompletionClientRecorder only supports the modes 'record' (capture LLM calls to a session file) and 'replay' (serve cached responses from a session file). Passing any other value for mode reaches the terminal else branch in create() and raises this ValueError.","triggerScenarios":"Constructing ChatCompletionClientRecorder with mode set to something other than 'record' or 'replay' (e.g. 'playback', 'Replay' with wrong casing, 'test', or None), then calling create().","commonSituations":"Typos or casing mistakes in the mode string; passing a mode variable that was never initialized; mode loaded from config/JSON with an unexpected value.","solutions":["Set mode to exactly \"record\" or \"replay\" (lowercase) when constructing the recorder.","If mode comes from config, validate it against {\"record\", \"replay\"} before constructing the client."],"exampleFix":"# before\nrecorder = ChatCompletionClientRecorder(client, mode=\"playback\", session_file_path=\"s.json\")\n# after\nrecorder = ChatCompletionClientRecorder(client, mode=\"replay\", session_file_path=\"s.json\")","handlingStrategy":"validation","validationCode":"assert mode in (\"record\", \"replay\"), f\"mode must be 'record' or 'replay', got {mode!r}\"\nrecorder = ChatCompletionClientRecorder(client, mode=mode, session_file_path=path)","typeGuard":"def is_valid_recorder_mode(mode: object) -> bool:\n    return isinstance(mode, str) and mode in {\"record\", \"replay\"}","tryCatchPattern":null,"preventionTips":["Validate mode against the literal set {'record', 'replay'} at config load time.","Derive mode from a Literal[\"record\", \"replay\"] typed variable so type checkers catch typos."],"tags":["autogen","configuration","invalid-argument"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}