chenhg5/cc-connect · error
invalid value for --log-max-size: %s
Error message
invalid value for --log-max-size: %s
What it means
parseDaemonInstallArgs parses `cc-connect daemon install` flags. When --log-max-size is given in space-separated form, the following token is converted with strconv.Atoi; this error is thrown if it is not a valid integer. The value is interpreted as megabytes (multiplied by 1024*1024 to become bytes).
Source
Thrown at cmd/cc-connect/daemon.go:154
case arg == "--no-capture-secrets":
cfg.NoCaptureSecrets = true
case arg == "--log-file":
value, next, err := daemonInstallFlagValue(args, i, "--log-file")
if err != nil {
return daemon.Config{}, false, err
}
cfg.LogFile = value
i = next
case strings.HasPrefix(arg, "--log-file="):
cfg.LogFile = strings.TrimPrefix(arg, "--log-file=")
case arg == "--log-max-size":
value, next, err := daemonInstallFlagValue(args, i, "--log-max-size")
if err != nil {
return daemon.Config{}, false, err
}
mb, err := strconv.Atoi(value)
if err != nil {
return daemon.Config{}, false, fmt.Errorf("invalid value for --log-max-size: %s", value)
}
cfg.LogMaxSize = int64(mb) * 1024 * 1024
i = next
case strings.HasPrefix(arg, "--log-max-size="):
value := strings.TrimPrefix(arg, "--log-max-size=")
mb, err := strconv.Atoi(value)
if err != nil {
return daemon.Config{}, false, fmt.Errorf("invalid value for --log-max-size: %s", value)
}
cfg.LogMaxSize = int64(mb) * 1024 * 1024
case arg == "--work-dir":
value, next, err := daemonInstallFlagValue(args, i, "--work-dir")
if err != nil {
return daemon.Config{}, false, err
}
cfg.WorkDir = value
i = next
case strings.HasPrefix(arg, "--work-dir="):View on GitHub (pinned to 4000b2338a)
Solutions
- Pass a bare integer number of megabytes, e.g. --log-max-size 10
- Remove unit suffixes (MB, MiB, m) from the value
- Ensure --log-max-size is followed by its numeric value before other flags
Example fix
// before cc-connect daemon install --log-max-size 10MB --config app.toml // after cc-connect daemon install --log-max-size 10 --config app.toml
Defensive patterns
Strategy: validation
Validate before calling
func validLogMaxSize(v string) bool { _, err := strconv.Atoi(v); return err == nil } Prevention
- Remember the unit is fixed: the number is megabytes
- Never place another flag immediately after --log-max-size
- Validate numeric flag values in wrapper scripts
When it happens
Trigger: `cc-connect daemon install --log-max-size 10MB` (suffix not allowed), `--log-max-size 2.5` (float rejected), `--log-max-size abc`, or `--log-max-size` followed by another flag such as `--log-max-size --config x.toml` (the flag name itself fails Atoi).
Common situations: Users copy sizes like '10MB' or '5m' from documentation of other tools, or forget the value after the flag so the next flag is consumed as the number.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- %s must be true or false
- timeout_mins must be an integer
- unknown flag: %s
- missing value for %s
- invalid --platform-type %q, want feishu or lark
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/843da17ee7c6d342.
Report an issue: GitHub.