{"record":{"id":"9d667a54150ea3f1","repo":"BerriAI/litellm","slug":"invalid-value-passed-in-for-aget-assistants-only","errorCode":null,"errorMessage":"Invalid value passed in for aget_assistants. Only bool or None allowed","messagePattern":"Invalid value passed in for aget_assistants\\. Only bool or None allowed","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/assistants/main.py","lineNumber":83,"sourceCode":"            model=\"\",\n            custom_llm_provider=custom_llm_provider,\n            original_exception=e,\n            completion_kwargs={},\n            extra_kwargs=kwargs,\n        )\n\n\ndef get_assistants(\n    custom_llm_provider: Literal[\"openai\", \"azure\"],\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) -> SyncCursorPage[Assistant]:\n    aget_assistants: Final[bool | None] = kwargs.pop(\"aget_assistants\", None)\n    if aget_assistants is not None and not isinstance(aget_assistants, bool):\n        raise Exception(\"Invalid value passed in for aget_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":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/assistants/main.py#L65-L101","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nassistants = litellm.get_assistants(\n    custom_llm_provider=\"openai\", aget_assistants=\"true\"\n)\n\n# after\nassistants = await litellm.aget_assistants(\n    custom_llm_provider=\"openai\"\n)\n","handlingStrategy":"type-guard","validationCode":"kwargs.pop(\"aget_assistants\", None)  # never forward this internal flag\nassistants = litellm.get_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    assistants = litellm.get_assistants(custom_llm_provider=\"openai\", **kwargs)\nexcept Exception as e:\n    if \"aget_assistants\" in str(e):\n        raise TypeError(\"remove aget_assistants; use litellm.aget_assistants()\") from e\n    raise\n","preventionTips":["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"],"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"}