multica-ai/multica · error

%s must be a Go duration (e.g. 10s, 500ms): %w

Error message

%s must be a Go duration (e.g. 10s, 500ms): %w

What it means

assignPositiveDuration is the shared parser for every persisted daemon duration knob except agent_timeout (heartbeat_interval, codex_semantic_inactivity_timeout, codex_handshake_timeout, auto_update_check_interval). It trims whitespace, parses with time.ParseDuration, and requires Go duration syntax with a unit suffix.

Source

Thrown at server/cmd/multica/cmd_config.go:284

		return fmt.Errorf("%s must be 'true' or 'false' (got %q)", key, value)
	}
	*dst = b
	return nil
}

// assignPositiveDuration parses value as a strictly-positive Go duration
// and writes the raw string into dst. Shared by every persisted daemon
// duration knob except agent_timeout, whose zero value is meaningful.
// Empty string clears the field.
func assignPositiveDuration(dst *string, key, value string) error {
	if value == "" {
		*dst = ""
		return nil
	}
	normalized := strings.TrimSpace(value)
	d, err := time.ParseDuration(normalized)
	if err != nil {
		return fmt.Errorf("%s must be a Go duration (e.g. 10s, 500ms): %w", key, err)
	}
	if d <= 0 {
		return fmt.Errorf("%s must be positive (got %s); use `config set %s \"\"` to clear it", key, d, key)
	}
	*dst = normalized
	return nil
}

// agentTimeoutDisplay renders the tri-state agent_timeout value for
// `config show`. nil = not persisted (fall through to env/default);
// non-nil "0s" = explicitly disabled; any other non-nil = the persisted
// duration string.
func agentTimeoutDisplay(v *string) string {
	if v == nil {
		return "(not set)"
	}
	if *v == "" {
		return "(not set)"

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Write the value with a unit: `multica config set heartbeat_interval 30s`.
  2. To clear: pass an empty string (`config set heartbeat_interval ""`).

Example fix

# before
multica config set heartbeat_interval 45
# after
multica config set heartbeat_interval 45s
Defensive patterns

Strategy: validation

Validate before calling

# unit-suffix check shared by all positive-duration knobs
[[ "$VAL" =~ ^[0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h)+$ ]] || { echo "bad duration: $VAL" >&2; exit 2; }
multica config set heartbeat_interval "$VAL"

Prevention

When it happens

Trigger: `multica config set heartbeat_interval 30` (no unit), `... 30 sec`, or a value consisting only of whitespace-after-trim artifacts.

Common situations: Same bare-number habit as poll_interval; values copied from dash-style configs; compound durations missing a unit on the last component.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/5debab27cd06225b. Report an issue: GitHub.