{"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":"exception","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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/assistants/main.py#L232-L268","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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)."],"exampleFix":"# before\nlitellm.create_assistant(model=\"gpt-4o\", name=\"bot\", async_create_assistants=\"true\")\n\n# after\nawait litellm.acreate_assistant(model=\"gpt-4o\", name=\"bot\")\n# or: litellm.create_assistant(model=\"gpt-4o\", name=\"bot\", async_create_assistants=True)","handlingStrategy":"type-guard","validationCode":"if \"async_create_assistants\" in kwargs and not isinstance(kwargs[\"async_create_assistants\"], (bool, type(None))):\n    kwargs[\"async_create_assistants\"] = parse_bool(kwargs[\"async_create_assistants\"])  # or pop it","typeGuard":"def is_valid_assistants_flag(v) -> bool:\n    return v is None or isinstance(v, bool)","tryCatchPattern":null,"preventionTips":["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."],"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"}