Skip to content

Commit ef31328

Browse files
committed
fix(#759): validate_model_syntax error strings now use newline separator so hint is non-null
1 parent b8b3af6 commit ef31328

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

ROADMAP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7683,3 +7683,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
76837683
757. **`--permission-mode bogus` and `--allowedTools` (no value) returned `error_kind:"unknown"` + `hint:null`** — dogfooded 2026-05-26 on `4df14618`. `parse_permission_mode_arg()` error format had no prefix and no `\n`; `--allowedTools` missing-value string was plain. Fix: prefix `parse_permission_mode_arg` error with `invalid_flag_value:` + `\n` valid-values hint (both call sites); prefix `--allowedTools` missing-value with `missing_flag_value:` + `\n` usage hint. Both now classified by existing `missing_flag_value`/`invalid_flag_value` arms added in #756. Source: Jobdori dogfood on `4df14618`, 2026-05-26.
76847684

76857685
758. **Three remaining `missing value for --X` strings in `parse_init_args` were still untyped** — dogfooded 2026-05-26 on `02d77ae1`. `--cwd`, `--date`, `--session` missing-value errors in the init-args parser used the old plain-string form with no `missing_flag_value:` prefix and no `\n` hint, unlike the main `parse_args` flags fixed in #756/#757. Fix: applied `missing_flag_value:` prefix + `\n` usage hint to all three. `grep '"missing value for --'` now returns zero results outside of test assertions. Source: Jobdori dogfood sweep on `02d77ae1`, 2026-05-26.
7686+
7687+
759. **`--model badmodel --output-format json` returned `error_kind:"invalid_model_syntax"` but `hint: null`** — dogfooded 2026-05-26 on `b8b3af6f`. `validate_model_syntax()` had hint text embedded after a period in the error string (no `\n`), so `split_error_hint()` could not extract it. Affected paths: (a) generic invalid format `"invalid model syntax: '{}'. Expected ..."` — joined with `.` not `\n`; (b) spaces-in-model `"contains spaces. Use ..."` — same issue; (c) empty model string — no hint at all. Fix: added `\n` before hint text in all three format strings in `validate_model_syntax`. Source: Jobdori dogfood sweep on `b8b3af6f`, 2026-05-26.

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,12 +1778,12 @@ fn resolve_model_alias_with_config(model: &str) -> String {
17781778
fn validate_model_syntax(model: &str) -> Result<(), String> {
17791779
let trimmed = model.trim();
17801780
if trimmed.is_empty() {
1781-
return Err("model string cannot be empty".to_string());
1781+
return Err("invalid model syntax: model string cannot be empty.\nUsage: --model <provider/model> e.g. --model anthropic/claude-opus-4-7".to_string());
17821782
}
17831783
// Check for spaces (malformed)
17841784
if trimmed.contains(' ') {
17851785
return Err(format!(
1786-
"invalid model syntax: '{}' contains spaces. Use provider/model format or known alias",
1786+
"invalid model syntax: '{}' contains spaces.\nUse provider/model format (e.g., anthropic/claude-opus-4-7) or a known alias.",
17871787
trimmed
17881788
));
17891789
}
@@ -1792,7 +1792,7 @@ fn validate_model_syntax(model: &str) -> Result<(), String> {
17921792
if parts.len() != 2 || parts[0].is_empty() || parts[1].is_empty() {
17931793
// #154: hint if the model looks like it belongs to a different provider
17941794
let mut err_msg = format!(
1795-
"invalid model syntax: '{}'. Expected provider/model (e.g., anthropic/claude-opus-4-6)",
1795+
"invalid model syntax: '{}'.\nExpected provider/model (e.g., anthropic/claude-opus-4-7)",
17961796
trimmed
17971797
);
17981798
if trimmed.starts_with("gpt-") || trimmed.starts_with("gpt_") {

0 commit comments

Comments
 (0)