{"record":{"id":"d9f9e5d2e222fcaf","repo":"BerriAI/litellm","slug":"invalid-value-passed-in-for-async-delete-assistant","errorCode":null,"errorMessage":"Invalid value passed in for async_delete_assistants. Only bool or None allowed","messagePattern":"Invalid value passed in for async_delete_assistants\\. Only bool or None allowed","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/assistants/main.py","lineNumber":425,"sourceCode":"        )\n\n\ndef delete_assistant(\n    custom_llm_provider: Literal[\"openai\", \"azure\"],\n    assistant_id: str,\n    client: Any | None = None,\n    api_key: str | None = None,\n    api_base: str | None = None,\n    api_version: str | None = None,\n    **kwargs,\n) -> AssistantDeleted | Coroutine[Any, Any, AssistantDeleted]:\n    optional_params: Final = GenericLiteLLMParams(api_key=api_key, api_base=api_base, api_version=api_version, **kwargs)\n\n    litellm_params_dict: Final = get_litellm_params(**kwargs)\n\n    async_delete_assistants: Final[bool | None] = kwargs.pop(\"async_delete_assistants\", None)\n    if async_delete_assistants is not None and not isinstance(async_delete_assistants, bool):\n        raise ValueError(\"Invalid value passed in for async_delete_assistants. Only bool or None allowed\")\n\n    ### TIMEOUT LOGIC ###\n    timeout = optional_params.timeout or kwargs.get(\"request_timeout\", 600) or 600\n    # set timeout for 10 minutes by default\n\n    if (\n        timeout is not None\n        and isinstance(timeout, httpx.Timeout)\n        and supports_httpx_timeout(custom_llm_provider) is False\n    ):\n        read_timeout: Final = timeout.read or 600\n        timeout = read_timeout  # default 10 min timeout\n    elif timeout is not None and not isinstance(timeout, httpx.Timeout):\n        timeout = float(timeout)\n    elif timeout is None:\n        timeout = 600.0\n\n    response: AssistantDeleted | Coroutine[Any, Any, AssistantDeleted] | None = None","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/assistants/main.py#L407-L443","documentation":"litellm.delete_assistants() pops async_delete_assistants to select the sync or async deletion path. As with the other assistant endpoints, the flag must be bool or None — any other type raises this ValueError before the delete request is built. The public API never requires you to pass it.","triggerScenarios":"Calling litellm.delete_assistants(..., async_delete_assistants=\"true\") or =1; forwarding unsanitized kwargs dicts (e.g. from a web handler) that contain the internal flag as a non-bool.","commonSituations":"JSON request bodies where booleans are strings; framework adapters that pass through everything; older snippets using string flags copied into new code.","solutions":["Use litellm.delete_assistants() sync or litellm.async_delete_assistants() async rather than the flag","If passing it, pass True/False (or None), never a string or int","Strip internal flags (async_delete_assistants, aget_assistants, async_create_assistants) from forwarded kwargs","Normalize booleans at your API boundary before calling LiteLLM"],"exampleFix":"# before\nresult = litellm.delete_assistants(\n    custom_llm_provider=\"openai\",\n    assistant_id=\"asst_123\",\n    async_delete_assistants=\"yes\",\n)\n\n# after\nresult = await litellm.async_delete_assistants(\n    custom_llm_provider=\"openai\",\n    assistant_id=\"asst_123\",\n)\n","handlingStrategy":"type-guard","validationCode":"kwargs.pop(\"async_delete_assistants\", None)\ndeleted = litellm.delete_assistants(custom_llm_provider=\"openai\", **kwargs)\n","typeGuard":"def is_bool_or_none(value: object) -> bool:\n    return value is None or isinstance(value, bool)\n","tryCatchPattern":"try:\n    deleted = litellm.delete_assistants(custom_llm_provider=\"openai\", **kwargs)\nexcept ValueError as e:\n    if \"async_delete_assistants\" in str(e):\n        raise TypeError(\"pass a bool or use litellm.async_delete_assistants()\") from e\n    raise\n","preventionTips":["Prefer litellm.async_delete_assistants() for async deletion","Validate typed kwargs at framework boundaries before they reach LiteLLM","Document which kwargs are public in your wrapper API"],"tags":["assistants","openai","delete","type-validation","kwargs"],"backgroundTag":"invalid-argument-value","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}