multica-ai/multica · error

download timeout must be greater than zero

Error message

download timeout must be greater than zero

What it means

Thrown by `multica update` when the --download-timeout flag is set to zero or a negative duration. The value defaults to cli.DefaultUpdateDownloadTimeout, so this only fires when the user explicitly overrides it. The guard exists because a non-positive timeout would make the HTTP client for the release-archive download fail immediately or hang forever.

Source

Thrown at server/cmd/multica/cmd_update.go:28

	"github.com/multica-ai/multica/server/internal/cli"
)

var updateDownloadTimeout time.Duration = cli.DefaultUpdateDownloadTimeout

var updateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update multica to the latest version",
	RunE:  runUpdate,
}

func init() {
	updateCmd.Flags().DurationVar(&updateDownloadTimeout, "download-timeout", cli.DefaultUpdateDownloadTimeout, "Maximum time to wait for the release archive download")
}

func runUpdate(_ *cobra.Command, _ []string) error {
	if updateDownloadTimeout <= 0 {
		return fmt.Errorf("download timeout must be greater than zero")
	}

	fmt.Fprintf(os.Stderr, "Current version: %s (commit: %s, built: %s)\n", version, commit, date)

	// Check latest version from GitHub.
	latest, err := cli.FetchLatestRelease()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Warning: could not check latest version: %v\n", err)
	} else {
		latestVer := strings.TrimPrefix(latest.TagName, "v")
		currentVer := strings.TrimPrefix(version, "v")
		if currentVer == latestVer {
			fmt.Fprintln(os.Stderr, "Already up to date.")
			return nil
		}
		fmt.Fprintf(os.Stderr, "Latest version:  %s\n\n", latest.TagName)
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Pass a positive Go duration with a unit, e.g. `multica update --download-timeout 120s` (or 2m).
  2. If the value comes from a script/env var, verify it is non-empty and parses to a positive duration before invoking the command.
  3. Omit the flag entirely to use the sane default (cli.DefaultUpdateDownloadTimeout).

Example fix

# before
multica update --download-timeout 0

# after
multica update --download-timeout 120s
Defensive patterns

Strategy: validation

Validate before calling

# validate before invoking
TIMEOUT="${TIMEOUT:-120s}"
if [ -z "$TIMEOUT" ] || ! grep -qE '^[0-9]+(ns|us|µs|ms|s|m|h)([0-9]+(ns|us|µs|ms|s|m|h))*$' "$TIMEOUT"; then
  echo "invalid timeout: $TIMEOUT" >&2; exit 1
fi
multica update --download-timeout "$TIMEOUT"

Prevention

When it happens

Trigger: Running `multica update --download-timeout 0` or `--download-timeout -5s`. The check `updateDownloadTimeout <= 0` in runUpdate fires before any network call.

Common situations: Scripts that set the timeout from an unset/empty environment variable (Go parses "" as 0), or users copying a duration flag from another tool and dropping the unit suffix.

Understand the failure class

Related errors


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