wavetermdev/waveterm · error

invalid format: expected [name]=[value]

Error message

invalid format: expected [name]=[value]

What it means

`wsh secret set` expects exactly one argument of the form NAME=VALUE, split on the first '='. If the argument contains no '=' at all, SplitN returns a single-element slice and the command rejects it with this error before any validation or RPC.

Source

Thrown at cmd/wsh/cmd/wshcmd-secret.go:109

	}

	value, ok := resp[name]
	if !ok {
		return fmt.Errorf("secret not found: %s", name)
	}

	WriteStdout("%s\n", value)
	return nil
}

func secretSetRun(cmd *cobra.Command, args []string) (rtnErr error) {
	defer func() {
		sendActivity("secret", rtnErr == nil)
	}()

	parts := strings.SplitN(args[0], "=", 2)
	if len(parts) != 2 {
		return fmt.Errorf("invalid format: expected [name]=[value]")
	}

	name := parts[0]
	value := parts[1]

	if name == "" {
		return fmt.Errorf("secret name cannot be empty")
	}

	backend, err := wshclient.GetSecretsLinuxStorageBackendCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 2000})
	if err != nil {
		return fmt.Errorf("checking secret storage backend: %w", err)
	}

	if backend == "basic_text" || backend == "unknown" {
		return fmt.Errorf("No appropriate secret manager found, cannot set secrets")
	}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Pass a single argument containing '=': `wsh secret set mykey=myvalue` (quote it if the value contains spaces or shell metacharacters).
  2. Quote the whole argument when the value is empty or has special chars: `wsh secret set "mykey="` or `wsh secret set "mykey=some value here"`.
  3. In scripts, build the arg safely: `wsh secret set "${name}=${value}"`.
  4. Check the command's usage via `wsh secret set --help` for the [name]=[value] syntax.

Example fix

// before
wsh secret set api_key
// after
wsh secret set "api_key=sk-1234"
Defensive patterns

Strategy: validation

Validate before calling

if !strings.Contains(arg, "=") {
    return fmt.Errorf("argument must be NAME=VALUE, got %q", arg)
}

Prevention

When it happens

Trigger: Running `wsh secret set mysecret` (value forgotten), or passing the name and value as two separate arguments (cobra's ExactArgs(1) makes the second arg fail arg validation, but a single quoted string without '=' hits this error), e.g. `wsh secret set "mysecret"` or `wsh secret set mysecret value`.

Common situations: Shell quoting mistakes where the '=' was consumed or separated (e.g. `wsh secret set key =$val` with spaces); translating from `export KEY value` style commands; scripts building the argument and dropping the '=' when the value is empty and unquoted.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/b0362ae3c00ae4db. Report an issue: GitHub.