chenhg5/cc-connect · error

invalid boolean: %s

Error message

invalid boolean: %s

What it means

Display settings setter for thinking_messages: strconv.ParseBool rejected the provided value; only Go ParseBool forms (1/t/T/TRUE/true/True, 0/f/F/FALSE/false/False) are accepted when setting the option via the display settings command.

Source

Thrown at core/engine.go:15133

				if e.displaySaveFunc != nil {
					tm := e.display.ThinkingMessages
					tool := e.display.ToolMessages
					return e.displaySaveFunc(&v, &tm, nil, nil, &tool)
				}
				return nil
			},
		},
		{
			key:    "thinking_messages",
			desc:   "Whether thinking messages are shown (true/false)",
			descZh: "是否显示思考消息 (true/false)",
			getFunc: func() string {
				return fmt.Sprintf("%t", e.display.ThinkingMessages)
			},
			setFunc: func(v string) error {
				b, err := strconv.ParseBool(v)
				if err != nil {
					return fmt.Errorf("invalid boolean: %s", v)
				}
				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 {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Use "true" or "false" (also accepted: 1/0, t/f, T/F, TRUE/FALSE, True/False).
  2. Trim whitespace and quotes around the value in config.toml.
  3. Convert yes/no style values to true/false before applying.

Example fix

// before
setFunc("yes") // error
// after
setFunc("true")
Defensive patterns

Strategy: validation

Validate before calling

if _, err := strconv.ParseBool(strings.TrimSpace(v)); err != nil { return fmt.Errorf("invalid boolean: %s", v) }

Try / catch

if err := setThinkingMessages(v); err != nil {
    if strings.Contains(err.Error(), "invalid boolean") { /* re-prompt with true/false */ }
    return err
}

Prevention

When it happens

Trigger: Setting the thinking-messages option with a value like "yes", "on", "enabled", or "true " (whitespace) that ParseBool rejects.

Common situations: Config file written with YAML-style `yes`/`no` booleans; user typing natural-language booleans in an interactive set command.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/f478ae71d4d9840f. Report an issue: GitHub.