HKUDS/nanobot · error · ValueError

Invalid thinking_style

Error message

Invalid thinking_style {v!r}. Must be one of: {', '.join(repr(s) for s in cls._VALID_THINKING_STYLES)} (or empty/omitted).

What it means

In ProviderConfig._validate_thinking_style, the configured thinking_style is a non-empty string outside the allowed set (thinking_type, enable_thinking, reasoning_split). These values select which reasoning-parameter shape is injected for OpenAI-compatible providers, mirroring _THINKING_STYLE_MAP in openai_compat_provider.py; the input at fault is the misspelled thinking_style.

Solutions

  1. Set thinking_style to one of: thinking_type, enable_thinking, reasoning_split
  2. Leave thinking_style empty/omitted to disable reasoning-parameter injection
  3. Match the parameter shape your provider's API actually supports
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nanobot/config/schema.py:233 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/f870c30eeff0c716. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/config/schema.py:233

    proxy: str | None = None  # Explicit HTTP proxy; image downloads trust its DNS and egress
    thinking_style: str | None = None  # Thinking/reasoning style for custom providers

    # Valid values mirror the keys of _THINKING_STYLE_MAP in
    # nanobot/providers/openai_compat_provider.py. Kept duplicated here to
    # avoid an import cycle (schema.py must not import from providers/).
    _VALID_THINKING_STYLES: ClassVar[tuple[str, ...]] = (
        "thinking_type",
        "enable_thinking",
        "reasoning_split",
    )

    @field_validator("thinking_style")
    @classmethod
    def _validate_thinking_style(cls, v: str | None) -> str | None:
        if not v:  # None or "" -> no injection, valid (backwards compatible)
            return v
        if v not in cls._VALID_THINKING_STYLES:
            raise ValueError(
                f"Invalid thinking_style {v!r}. "
                f"Must be one of: {', '.join(repr(s) for s in cls._VALID_THINKING_STYLES)} "
                f"(or empty/omitted)."
            )
        return v


class BedrockProviderConfig(ProviderConfig):
    """AWS Bedrock Runtime provider configuration."""

    region: str | None = None  # AWS region, falls back to AWS_REGION/AWS_DEFAULT_REGION/profile
    profile: str | None = None  # Optional AWS shared config profile


class ProvidersConfig(Base):
    """Configuration for LLM providers.

    Supports custom providers via extra fields — any additional field

View on GitHub (pinned to 42f37dc4c0)