zeroclaw-labs/zeroclaw · error · anyhow::Error

'temperature' must be between 0.0 and 2.0

Error message

'temperature' must be between 0.0 and 2.0

What it means

handle_set_default validated the temperature update against the model-provider convention of 0.0–2.0 and the supplied value is outside that range. Out-of-range sampling temperatures are rejected before the config is written.

Solutions

  1. Set temperature between 0.0 and 2.0.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/model_routing_config.rs:593 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/6d7a5a5106914c69. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-tools/src/model_routing_config.rs:593

                            "alias": &alias_k,
                        })),
                    "model_routing_config: unknown model_provider type"
                );
                anyhow::Error::msg(format!(
                    "unknown model_provider type `{type_k}`. no typed slot in ModelProviders"
                ))
            })?;

        match model_update {
            MaybeSet::Set(model) => entry.model = Some(model),
            MaybeSet::Null => entry.model = None,
            MaybeSet::Unset => {}
        }

        match temperature_update {
            MaybeSet::Set(temperature) => {
                if !(0.0..=2.0).contains(&temperature) {
                    anyhow::bail!("'temperature' must be between 0.0 and 2.0");
                }
                entry.temperature = Some(temperature);
            }
            MaybeSet::Null => {
                entry.temperature = None;
            }
            MaybeSet::Unset => {}
        }

        cfg.save().await?;

        // Probe the new model with a minimal API call to catch invalid model IDs
        // before the channel hot-reload picks up the change.
        let current_model = cfg
            .providers
            .models
            .find(&type_k, &alias_k)
            .and_then(|e| e.model.clone());

View on GitHub (pinned to 88bb9c8533)