{"record":{"id":"16808c80ac2a6e95","repo":"BerriAI/litellm","slug":"invalid-value-passed-in-for-async-create-assistant","errorCode":null,"errorMessage":"Invalid value passed in for async_create_assistants. Only bool or None allowed","messagePattern":"Invalid value passed in for async_create_assistants\\. Only bool or None allowed","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/assistants/main.py","lineNumber":250,"sourceCode":"    model: str,\n    name: str | None = None,\n    description: str | None = None,\n    instructions: str | None = None,\n    tools: list[dict[str, Any]] | None = None,\n    tool_resources: dict[str, Any] | None = None,\n    metadata: dict[str, str] | None = None,\n    temperature: float | None = None,\n    top_p: float | None = None,\n    response_format: str | dict[str, str] | None = None,\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) -> Assistant | Coroutine[Any, Any, Assistant]:\n    async_create_assistants: Final[bool | None] = kwargs.pop(\"async_create_assistants\", None)\n    if async_create_assistants is not None and not isinstance(async_create_assistants, bool):\n        raise ValueError(\"Invalid value passed in for async_create_assistants. Only bool or None allowed\")\n    optional_params: Final = GenericLiteLLMParams(api_key=api_key, api_base=api_base, api_version=api_version, **kwargs)\n    litellm_params_dict: Final = get_litellm_params(**kwargs)\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","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/assistants/main.py#L232-L268","documentation":"litellm.create_assistants() pops async_create_assistants to route between sync and async creation. The flag must be bool or None; anything else raises this ValueError before any API call. It is an internal switch set by litellm.async_create_assistants(), not a user-facing parameter.","triggerScenarios":"Calling litellm.create_assistants(..., async_create_assistants=\"yes\"); passing async_create_assistants=1; generic proxying of a request kwargs dict that includes the internal flag with a string value.","commonSituations":"Bridges from REST/JSON payloads where booleans arrive as strings; code migration from older examples that used string flags; double-wrapping LiteLLM APIs and leaking internal kwargs through.","solutions":["Use litellm.create_assistants() for sync and litellm.async_create_assistants() for async instead of the flag","Pass only a real bool or omit async_create_assistants entirely","Coerce incoming flags: bool(flag) or strip them from forwarded kwargs","Add a type check on dynamic kwargs before delegating to LiteLLM"],"exampleFix":"# before\nassistant = litellm.create_assistants(\n    custom_llm_provider=\"openai\",\n    name=\"math_tutor\",\n    async_create_assistants=\"true\",\n)\n\n# after\nassistant = await litellm.async_create_assistants(\n    custom_llm_provider=\"openai\",\n    name=\"math_tutor\",\n)\n","handlingStrategy":"type-guard","validationCode":"kwargs.pop(\"async_create_assistants\", None)\nassistant = litellm.create_assistants(custom_llm_provider=\"openai\", **kwargs)\n","typeGuard":"def is_valid_switch(value: object) -> bool:\n    return value is None or isinstance(value, bool)\n","tryCatchPattern":"try:\n    assistant = litellm.create_assistants(custom_llm_provider=\"openai\", **kwargs)\nexcept ValueError as e:\n    if \"async_create_assistants\" in str(e):\n        raise TypeError(\"pass a bool or use litellm.async_create_assistants()\") from e\n    raise\n","preventionTips":["Use the dedicated async entry points instead of internal switches","Sanitize kwargs dicts forwarded from JSON payloads (booleans-as-strings)","Keep a denylist of internal flags in wrapper code"],"tags":["assistants","openai","type-validation","kwargs","api-misuse"],"backgroundTag":"invalid-argument-value","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}