The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(cli): tolerate an unreadable prior config when carrying the autoroute key forward
Tin Chi Lo051cdd1dcec3
diff --git a/litellm/proxy/client/cli/commands/autoroute/wizard.py b/litellm/proxy/client/cli/commands/autoroute/wizard.pyindex 7e89f5c0f58..8ad87315fb9 100644--- a/litellm/proxy/client/cli/commands/autoroute/wizard.py+++ b/litellm/proxy/client/cli/commands/autoroute/wizard.py@@ -100,7 +100,7 @@ def _load_persisted_master_key(config_path: Path) -> str | None:return Nonetry:raw = _RAW_CONFIG_ADAPTER.validate_python(yaml.safe_load(config_path.read_text()))- except (yaml.YAMLError, ValidationError):+ except (OSError, UnicodeDecodeError, yaml.YAMLError, ValidationError):return Nonereturn master_key_from_config(raw)diff --git a/tests/test_litellm/proxy/client/cli/autoroute/test_wizard.py b/tests/test_litellm/proxy/client/cli/autoroute/test_wizard.pyindex 89406615cf4..78d4bd20338 100644--- a/tests/test_litellm/proxy/client/cli/autoroute/test_wizard.py+++ b/tests/test_litellm/proxy/client/cli/autoroute/test_wizard.py@@ -160,6 +160,14 @@ class TestRunConfigureWizardMasterKeyCarryForward:assert result.exit_code == 0, result.outputassert "general_settings" not in yaml.safe_load(config_path.read_text())+ def test_undecodable_prior_config_does_not_block_reconfigure(self, tmp_path):+ (tmp_path / "config.yaml").write_bytes(b"\xff\xfe\x00 not utf-8")++ result, config_path = _run(tmp_path, CHAT_AND_EMBEDDING_GROUPS, _SIMPLE_TIER_PICKS, input_str="n\nn\nn\n")++ assert result.exit_code == 0, result.output+ assert "general_settings" not in yaml.safe_load(config_path.read_text())+def test_no_embedding_pool_skips_semantic_prompt_entirely(self, tmp_path):result, config_path = _run(tmp_path, CHAT_ONLY_GROUPS, _SIMPLE_TIER_PICKS, input_str="n\nn\n")