BerriAI/litellm · error · ValueError
Invalid value passed in for async_create_assistants. Only bo
Error message
Invalid value passed in for async_create_assistants. Only bool or None allowed
What it means
Raised by litellm.assistants.create_assistant when the 'async_create_assistants' kwarg is not a bool or None. Like the other assistants functions, this internal flag selects the sync vs async code path and is strictly type-checked via kwargs.pop before any API call is made.
Source
Thrown at litellm/assistants/main.py:250
model: str,
name: str | None = None,
description: str | None = None,
instructions: str | None = None,
tools: list[dict[str, Any]] | None = None,
tool_resources: dict[str, Any] | None = None,
metadata: dict[str, str] | None = None,
temperature: float | None = None,
top_p: float | None = None,
response_format: str | dict[str, str] | None = None,
client: Any | None = None,
api_key: str | None = None,
api_base: str | None = None,
api_version: str | None = None,
**kwargs,
) -> Assistant | Coroutine[Any, Any, Assistant]:
async_create_assistants: Final[bool | None] = kwargs.pop("async_create_assistants", None)
if async_create_assistants is not None and not isinstance(async_create_assistants, bool):
raise ValueError("Invalid value passed in for async_create_assistants. Only bool or None allowed")
optional_params: Final = GenericLiteLLMParams(api_key=api_key, api_base=api_base, api_version=api_version, **kwargs)
litellm_params_dict: Final = get_litellm_params(**kwargs)
### TIMEOUT LOGIC ###
timeout = optional_params.timeout or kwargs.get("request_timeout", 600) or 600
# set timeout for 10 minutes by default
if (
timeout is not None
and isinstance(timeout, httpx.Timeout)
and supports_httpx_timeout(custom_llm_provider) is False
):
read_timeout: Final = timeout.read or 600
timeout = read_timeout # default 10 min timeout
elif timeout is not None and not isinstance(timeout, httpx.Timeout):
timeout = float(timeout)
elif timeout is None:
timeout = 600.0View on GitHub (pinned to 6c2dcb801b)
Solutions
- Omit the kwarg entirely, or pass a literal bool: async_create_assistants=True.
- Prefer calling litellm.acreate_assistant(...) for async usage instead of the internal flag.
- Coerce config-sourced flags with a helper like value in (True, 'true', '1', 1).
Example fix
# before litellm.create_assistant(model="gpt-4o", name="bot", async_create_assistants="true") # after await litellm.acreate_assistant(model="gpt-4o", name="bot") # or: litellm.create_assistant(model="gpt-4o", name="bot", async_create_assistants=True)
Defensive patterns
Strategy: type-guard
Validate before calling
if "async_create_assistants" in kwargs and not isinstance(kwargs["async_create_assistants"], (bool, type(None))):
kwargs["async_create_assistants"] = parse_bool(kwargs["async_create_assistants"]) # or pop it Type guard
def is_valid_assistants_flag(v) -> bool:
return v is None or isinstance(v, bool) Prevention
- Use litellm.acreate_assistant for async instead of the internal flag.
- Type your call wrappers so flags are bool, and coerce strings at the boundary.
- Add mypy checks on kwargs dicts where practical.
When it happens
Trigger: Calling litellm.create_assistant(...) with async_create_assistants set to a string, int, or other non-bool value (e.g. async_create_assistants=1 or 'yes'). Any of these fails isinstance(x, bool).
Common situations: Flags sourced from argparse/env vars arriving as strings; autogenerated client code that treats every option as a string; confusion between this internal flag and the public acreate_assistants async function.
Related errors
- Invalid value passed in for aget_assistants. Only bool or No
- Invalid value passed in for async_delete_assistants. Only bo
- 'models' must be a string or list of strings
- 'models' param not in kwargs
- input must be a string or a list
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/16808c80ac2a6e95.
Report an issue: GitHub.