{"record":{"id":"dfe5f3ce7f6f205f","repo":"BerriAI/litellm","slug":"mode-mode-not-supported-see-modes-here-https","errorCode":null,"errorMessage":"Mode {mode} not supported. See modes here: https://docs.litellm.ai/docs/proxy/health","messagePattern":"Mode (.+?) not supported\\. See modes here: https://docs\\.litellm\\.ai/docs/proxy/health","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/main.py","lineNumber":8421,"sourceCode":"                model_params=model_params,\n                litellm_logging_obj=litellm_logging_obj,\n            )\n\n        mode_handlers: Final = HealthCheckHelpers.get_mode_handlers(\n            model=model,\n            custom_llm_provider=custom_llm_provider,\n            model_params=model_params,\n            prompt=prompt,\n            input=input,\n        )\n\n        if mode in mode_handlers:\n            _response: Final = await mode_handlers[mode]()\n            # Only process headers for chat mode\n            _response_headers: Final[dict] = getattr(_response, \"_hidden_params\", {}).get(\"headers\", {}) or {}\n            return _create_health_check_response(_response_headers)\n        else:\n            raise Exception(f\"Mode {mode} not supported. See modes here: https://docs.litellm.ai/docs/proxy/health\")\n    except Exception as e:\n        stack_trace = _redact_string(traceback.format_exc())\n        if isinstance(stack_trace, str):\n            stack_trace = stack_trace[:1000]\n\n        if mode is None:\n            return {\n                \"error\": f\"error:{e}. Missing `mode`. Set the `mode` for the model - https://docs.litellm.ai/docs/proxy/health#embedding-models  \\nstacktrace: {stack_trace}\",\n                \"exception\": e,\n            }\n\n        error_to_return: Final = str(e) + \"\\nstack trace: \" + stack_trace\n\n        raw_request_typed_dict: Final = litellm_logging_obj.model_call_details.get(\"raw_request_typed_dict\")\n\n        return {\n            \"error\": error_to_return,\n            \"raw_request_typed_dict\": raw_request_typed_dict,","sourceCodeStart":8403,"sourceCodeEnd":8439,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/main.py#L8403-L8439","documentation":"ahealth_check() dispatches on the mode argument via a mode_handlers registry (chat, embedding, audio transcription, etc.). A mode string that is not a key in that registry raises this Exception pointing at the health-check docs.","triggerScenarios":"await litellm.ahealth_check(params, mode='vision') or mode='completion' — strings outside the supported set; or passing an explicit mode for a model not in litellm.model_cost (where inference would otherwise fill it in).","commonSituations":"Guessing mode names; writing 'embeddings' (plural) instead of 'embedding'; accepting the mode from user input without validation; checking a capability the health endpoint does not support.","solutions":["Use a supported mode value: 'chat', 'embedding', 'audio_transcription' (check the mode_handlers keys in litellm/main.py or the docs)","Or omit mode and ensure the model is in litellm.model_cost so mode is inferred","Validate mode against an allowlist before calling"],"exampleFix":"# before\nawait litellm.ahealth_check(params, mode=\"embeddings\")\n\n# after\nawait litellm.ahealth_check(params, mode=\"embedding\")","handlingStrategy":"validation","validationCode":"SUPPORTED_MODES = {\"chat\", \"embedding\", \"audio_transcription\"}  # mirror mode_handlers keys\nif mode is not None and mode not in SUPPORTED_MODES:\n    raise ValueError(f\"unsupported health-check mode: {mode!r}; use one of {sorted(SUPPORTED_MODES)}\")","typeGuard":null,"tryCatchPattern":"try:\n    result = await litellm.ahealth_check(params, mode=mode)\nexcept Exception as e:\n    if \"not supported\" in str(e) and mode:\n        raise ValueError(f\"bad health-check mode: {mode!r}\") from e\n    raise","preventionTips":["Define mode constants instead of passing raw strings","Let mode be inferred from model_cost metadata when possible"],"tags":["litellm","health-check","mode","validation"],"backgroundTag":"unsupported-mode","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}