BerriAI/litellm · error · Exception
Invalid value passed in for aget_assistants. Only bool or…
Error message
Invalid value passed in for aget_assistants. Only bool or None allowed
What it means
litellm.get_assistants() pops the private kwarg aget_assistants to decide whether to run the sync or async OpenAI/Azure assistants listing. The value must be a bool or None; any other type (string, int) raises this Exception immediately. Users are not supposed to pass it at all — aget_assistants=True is what litellm.aget_assistants() sets internally.
Solutions
- Do not pass aget_assistants yourself — use litellm.get_assistants(...) for sync and litellm.aget_assistants(...) for async
- If you must pass it, use a real bool (True/False) or None
- Sanitize forwarded kwargs to strip internal flags like aget_assistants before calling LiteLLM
- Check for accidental truthy strings like 'false' which are still invalid here
Example fix
# before
assistants = litellm.get_assistants(
custom_llm_provider="openai", aget_assistants="true"
)
# after
assistants = await litellm.aget_assistants(
custom_llm_provider="openai"
)
Defensive patterns
Strategy: type-guard
Validate before calling
kwargs.pop("aget_assistants", None) # never forward this internal flag
assistants = litellm.get_assistants(custom_llm_provider="openai", **kwargs)
Type guard
def is_bool_or_none(value: object) -> bool:
return value is None or isinstance(value, bool)
Try / catch
try:
assistants = litellm.get_assistants(custom_llm_provider="openai", **kwargs)
except Exception as e:
if "aget_assistants" in str(e):
raise TypeError("remove aget_assistants; use litellm.aget_assistants()") from e
raise
Prevention
- Call litellm.aget_assistants() for async instead of passing internal flags
- Strip internal kwargs (aget_assistants, async_* variants) in wrapper layers
- Coerce string booleans at your API boundary
When it happens
Trigger: Calling litellm.get_assistants(custom_llm_provider="openai", aget_assistants="true") or aget_assistants=1; forwarding an untyped kwargs dict from another layer that happens to contain aget_assistants with a non-bool value.
Common situations: Wrappers that pass through CLI/env-derived strings into kwargs; copying example code that spells the flag as a string; confusion between the public litellm.aget_assistants() API and the internal switch flag.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Invalid value passed in for async_create_assistants. Only…
- Invalid value passed in for async_delete_assistants. Only…
- 'models' param not in kwargs
- API base is required for OpenAI image variations
- api base needs to be a string. api_base=
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/9d667a54150ea3f1.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/assistants/main.py:83
model="",
custom_llm_provider=custom_llm_provider,
original_exception=e,
completion_kwargs={},
extra_kwargs=kwargs,
)
def get_assistants(
custom_llm_provider: Literal["openai", "azure"],
client: Any | None = None,
api_key: str | None = None,
api_base: str | None = None,
api_version: str | None = None,
**kwargs,
) -> SyncCursorPage[Assistant]:
aget_assistants: Final[bool | None] = kwargs.pop("aget_assistants", None)
if aget_assistants is not None and not isinstance(aget_assistants, bool):
raise Exception("Invalid value passed in for aget_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 77b7c6c40c)