Hmbown/CodeWhale · error
Model name cannot be empty
Error message
Model name cannot be empty
What it means
`codewhale model set <model>` trims the argument and refuses an empty string: an empty default model would break every later model resolution, so Codewhale validates before saving. Note that after this check the value is canonicalized (`pro`/`deepseek-v4pro` → `deepseek-v4-pro`, `flash` → `deepseek-v4-flash`, `auto` passes through) and persisted to config.
Source
Thrown at crates/cli/src/lib.rs:4270
"--provider".to_string()
} else {
provider_source_label(resolved_runtime.provider_source)
}
);
println!(
"model_source: {}",
if queried.is_some() {
"argument"
} else {
resolved_runtime.model_source.as_str()
}
);
Ok(())
}
ModelCommand::Set { model } => {
let trimmed = model.trim();
if trimmed.is_empty() {
bail!("Model name cannot be empty");
}
let canonical = match trimmed.to_ascii_lowercase().as_str() {
"pro" | "deepseek-v4pro" => "deepseek-v4-pro",
"flash" | "deepseek-v4flash" => "deepseek-v4-flash",
"auto" => "auto",
_ => trimmed,
};
store.config.default_text_model = Some(canonical.to_string());
store.save()?;
println!("Default model set to '{canonical}'");
Ok(())
}
}
}
/// The TUI passthrough a thread subcommand delegates as, if it delegates.
///
/// Exhaustive on purpose: a future `ThreadCommand` variant that starts aView on GitHub (pinned to 0c42157ee5)
Solutions
- Pass a concrete model name (e.g. `deepseek-v4-pro`) or an alias (`pro`, `flash`, `auto`)
- Fix the script: default the variable first, e.g. `MODEL=${MODEL:-auto}`
- To clear a default model, unset the config key rather than setting an empty one
Example fix
# before
$ MODEL= codewhale model set "$MODEL"
# Model name cannot be empty
# after
$ MODEL=${MODEL:-auto} codewhale model set "$MODEL" Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash
model="${MODEL:-}"
model="$(printf '%s' "$model" | tr -d '[:space:]')"
[ -n "$model" ] || model="auto"
codewhale model set "$model" Type guard
fn is_valid_model_name(name: &str) -> bool {
!name.trim().is_empty()
} Prevention
- Always default the variable: `model=${MODEL:-auto}`
- To clear a default model, unset the config key; never set it to an empty string
When it happens
Trigger: `codewhale model set ""`, `codewhale model set " "`, or scripts passing an unset shell variable (`MODEL=` or `$UNDEFINED`) as the model name.
Common situations: Shell scripts with unbound/empty variables; CI overriding the model with an empty string; users trying to 'reset' the model by setting it to empty.
Related errors
- unknown field '{field_key}' for built-in provider '{provider
- unknown field '{field_key}' for custom provider '{provider_i
- Unrecognized --provider {provider_arg:?}. Known providers: {
- The Codewhale service returned an account without an ID
- Codewhale account API base URL must not contain a query or f
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/46d65065f8684ef0.
Report an issue: GitHub.