chenhg5/cc-connect · error
invalid integer: %s
Error message
invalid integer: %s
What it means
The /config set handler for thinking_max_len could not parse the user-supplied value as an integer via strconv.Atoi. Validation error naming the offending raw string; callers must supply a non-negative number.
Source
Thrown at core/engine.go:15152
}
e.display.ThinkingMessages = b
if e.displaySaveFunc != nil {
return e.displaySaveFunc(nil, &b, nil, nil, nil)
}
return nil
},
},
{
key: "thinking_max_len",
desc: "Max chars for thinking messages (0=no truncation)",
descZh: "思考消息最大长度 (0=不截断)",
getFunc: func() string {
return fmt.Sprintf("%d", e.display.ThinkingMaxLen)
},
setFunc: func(v string) error {
n, err := strconv.Atoi(v)
if err != nil {
return fmt.Errorf("invalid integer: %s", v)
}
if n < 0 {
return fmt.Errorf("value must be >= 0")
}
e.display.ThinkingMaxLen = n
if e.displaySaveFunc != nil {
return e.displaySaveFunc(nil, nil, &n, nil, nil)
}
return nil
},
},
{
key: "tool_messages",
desc: "Whether tool progress messages are shown (true/false)",
descZh: "是否显示工具进度消息 (true/false)",
getFunc: func() string {
return fmt.Sprintf("%t", e.display.ToolMessages)
},View on GitHub (pinned to 4000b2338a)
Solutions
- Provide a plain integer, e.g. 2000.
- Remove units, commas, spaces, and quotes from the value.
- If the value comes from a form/UI, validate with strconv.Atoi on the client side first.
Example fix
// before
setFunc("2,000") // error
// after
setFunc("2000") Defensive patterns
Strategy: validation
Validate before calling
n, err := strconv.Atoi(strings.TrimSpace(v)); if err != nil || n < 0 { return fmt.Errorf("need a non-negative integer, got %q", v) } Try / catch
if err := setThinkingMaxLen(v); err != nil {
if strings.Contains(err.Error(), "invalid integer") { /* re-prompt for a plain number */ }
return err
} Prevention
- Enter plain integers without units, commas, or spaces.
- Sanitize numeric config fields at load time.
- Use a numeric input field (not free text) in any settings UI.
When it happens
Trigger: Setting the thinking-max-length option with a non-numeric value such as "2000 chars", "2,000", or an empty string.
Common situations: Pasting values with units or thousands separators into config.toml; leaving the field empty and having it parsed as "".
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- invalid boolean: %s
- acp: agent option "cmd" or "command" is required (path or na
- acp: command %q not found in PATH: %w
- claudecode: project dir not found
- resolve home directory: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/d9fee4e1535f7eee.
Report an issue: GitHub.