{"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":"exception","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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/assistants/main.py#L407-L443","documentation":"Raised by litellm.assistants.delete_assistant when the 'async_delete_assistants' kwarg is neither bool nor None. It is the same internal sync/async routing flag pattern used across the assistants API, validated right after GenericLiteLLMParams and get_litellm_params are built.","triggerScenarios":"Calling litellm.delete_assistant(...) with async_delete_assistants set to a non-bool such as 'false', 0-as-string, or a list. The isinstance check only accepts bool or None.","commonSituations":"String flags from environment/config plumbing; users trying to force async behavior with a string instead of using adelete_assistant; copy-pasted snippets across the assistants API where flag names differ subtly.","solutions":["Pass async_delete_assistants as a bool or drop it: litellm.delete_assistant(..., async_delete_assistants=True).","For async, call await litellm.adelete_assistant(...) directly.","Sanitize kwargs built from user input before forwarding to LiteLLM."],"exampleFix":"# before\nlitellm.delete_assistant(\"asst_abc\", async_delete_assistants=\"true\")\n\n# after\nawait litellm.adelete_assistant(\"asst_abc\")\n# or: litellm.delete_assistant(\"asst_abc\", async_delete_assistants=True)","handlingStrategy":"type-guard","validationCode":"if \"async_delete_assistants\" in kwargs and not isinstance(kwargs[\"async_delete_assistants\"], (bool, type(None))):\n    kwargs.pop(\"async_delete_assistants\")  # let LiteLLM pick the default path","typeGuard":"def is_valid_assistants_flag(v) -> bool:\n    return v is None or isinstance(v, bool)","tryCatchPattern":null,"preventionTips":["Use await litellm.adelete_assistant(...) for async deletion.","Keep a single sanitized kwargs builder for all assistants API calls.","Test wrappers with string flag values to catch coercion gaps."],"tags":["assistants","api-misuse","type-validation","python"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}