chenhg5/cc-connect · error

missing value for %s

Error message

missing value for %s

What it means

daemonInstallFlagValue reads the value that follows a space-separated flag. If the flag is the last token on the command line (index+1 beyond len(args)) there is no value to consume, so this error is returned for the given flagName. It guards flags like --config, --log-max-size, and --work-dir against being used without an operand.

Source

Thrown at cmd/cc-connect/daemon.go:196

			}
			cfg.WorkDir = filepath.Dir(value)
			i = next
		case strings.HasPrefix(arg, "--config="):
			cfg.WorkDir = filepath.Dir(strings.TrimPrefix(arg, "--config="))
		case strings.HasPrefix(arg, "-config="):
			cfg.WorkDir = filepath.Dir(strings.TrimPrefix(arg, "-config="))
		default:
			return daemon.Config{}, false, fmt.Errorf("unknown flag: %s", arg)
		}
	}

	return cfg, force, nil
}

func daemonInstallFlagValue(args []string, index int, flagName string) (string, int, error) {
	next := index + 1
	if next >= len(args) {
		return "", index, fmt.Errorf("missing value for %s", flagName)
	}
	return args[next], next, nil
}

// isTruthyEnv accepts the conventional opt-in values for boolean env vars.
// Anything else, including "0" / "false" / "" / unset, is treated as false.
func isTruthyEnv(v string) bool {
	switch strings.ToLower(strings.TrimSpace(v)) {
	case "1", "true", "yes", "on":
		return true
	}
	return false
}

// ── uninstall ───────────────────────────────────────────────

func daemonUninstall() {
	mgr, err := daemon.NewManager()

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Provide the value after the flag: --work-dir /path/to/dir
  2. Verify the shell variable supplying the value is non-empty before invoking the command
  3. Use the equals form (--work-dir=/path) to make the value explicit

Example fix

// before
cc-connect daemon install --work-dir "$WORK_DIR"   # WORK_DIR empty
// after
: "${WORK_DIR:?WORK_DIR must be set}" && cc-connect daemon install --work-dir "$WORK_DIR"
Defensive patterns

Strategy: validation

Validate before calling

: "${WORK_DIR:?missing value for --work-dir}"

Prevention

When it happens

Trigger: `cc-connect daemon install --work-dir` or `--config` given as the final argument, e.g. `daemon install --config` (nothing after it), or a quoted/escaped value that ends up empty in shell scripts.

Common situations: Shell scripts where a variable like $CONFIG_PATH is empty or unset, commands copied without the value, or line-continuation mistakes in multi-line shell commands.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


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