chenhg5/cc-connect · error
%s: invalid image_batch_window_ms %v: %w
Error message
%s: invalid image_batch_window_ms %v: %w
What it means
image_batch_window_ms failed coercion via coerceMilliseconds, meaning the configured value is not a Go numeric type (int/float variants). newPlatform returns this wrapped error naming the raw value. Coexists with the range check that follows (>= 0).
Source
Thrown at platform/feishu/feishu.go:422
switch strings.ToLower(strings.TrimSpace(v)) {
case "", "legacy":
progressStyle = "legacy"
case "compact", "card":
progressStyle = strings.ToLower(strings.TrimSpace(v))
default:
return nil, fmt.Errorf("%s: invalid progress_style %q (want legacy, compact, or card)", name, v)
}
}
useInteractiveCard := true
if v, ok := opts["enable_feishu_card"].(bool); ok {
useInteractiveCard = v
}
imageBatchWindow := defaultImageBatchWindow
if raw, ok := opts["image_batch_window_ms"]; ok {
ms, err := coerceMilliseconds(raw)
if err != nil {
return nil, fmt.Errorf("%s: invalid image_batch_window_ms %v: %w", name, raw, err)
}
if ms < 0 {
return nil, fmt.Errorf("%s: image_batch_window_ms must be >= 0, got %d", name, ms)
}
imageBatchWindow = time.Duration(ms) * time.Millisecond
}
// resource_chunk_size_bytes: byte size for each Range request when chunked-
// downloading Feishu message resources (issue #1741). The larkim SDK does
// not expose Range headers, so for resources above ~2 MiB a plain GET
// returns code=234037. Default 8 MiB; clamped to [1 MiB, 64 MiB].
resourceChunkSize := int64(8 * 1024 * 1024)
if raw, ok := opts["resource_chunk_size_bytes"]; ok {
n, err := coerceMilliseconds(raw)
if err != nil {
return nil, fmt.Errorf("%s: invalid resource_chunk_size_bytes %v: %w", name, raw, err)
}
if n > 0 {View on GitHub (pinned to 4000b2338a)
Solutions
- Use a bare integer: image_batch_window_ms = 300.
- Drop units like "ms" — the option is always in milliseconds.
- See the %T-wrapped coerce error in the chain for the offending type.
Example fix
// before (config.toml) image_batch_window_ms = "300ms" // after image_batch_window_ms = 300
Defensive patterns
Strategy: validation
Validate before calling
if raw, ok := opts["image_batch_window_ms"]; ok {
switch raw.(type) {
case int, int64, float32, float64:
default:
log.Fatalf("image_batch_window_ms must be a number, got %T", raw)
}
} Type guard
func isNumber(v any) bool { switch v.(type) { case int, int64, float32, float64: return true }; return false } Prevention
- Write millisecond integers without quotes or units.
- Run a config validation pass before launching the daemon.
When it happens
Trigger: image_batch_window_ms = "300" (quoted string), "300ms", true, or a table in the feishu platform options.
Common situations: Duration-suffix strings copied from other tools' configs; JSON-style quoted numbers in TOML.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- expected number, got %T
- %s: invalid resource_chunk_size_bytes %v: %w
- %s: app_id and app_secret are required
- %s: invalid domain %q: %w
- %s: invalid progress_style %q (want legacy, compact, or card
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/a7933a0d86311b45.
Report an issue: GitHub.