{"record":{"id":"b0362ae3c00ae4db","repo":"wavetermdev/waveterm","slug":"invalid-format-expected-name-value","errorCode":null,"errorMessage":"invalid format: expected [name]=[value]","messagePattern":"invalid format: expected \\[name\\]=\\[value\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-secret.go","lineNumber":109,"sourceCode":"\t}\n\n\tvalue, ok := resp[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"secret not found: %s\", name)\n\t}\n\n\tWriteStdout(\"%s\\n\", value)\n\treturn nil\n}\n\nfunc secretSetRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"secret\", rtnErr == nil)\n\t}()\n\n\tparts := strings.SplitN(args[0], \"=\", 2)\n\tif len(parts) != 2 {\n\t\treturn fmt.Errorf(\"invalid format: expected [name]=[value]\")\n\t}\n\n\tname := parts[0]\n\tvalue := parts[1]\n\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"secret name cannot be empty\")\n\t}\n\n\tbackend, err := wshclient.GetSecretsLinuxStorageBackendCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking secret storage backend: %w\", err)\n\t}\n\n\tif backend == \"basic_text\" || backend == \"unknown\" {\n\t\treturn fmt.Errorf(\"No appropriate secret manager found, cannot set secrets\")\n\t}\n","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-secret.go#L91-L127","documentation":"`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.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Pass a single argument containing '=': `wsh secret set mykey=myvalue` (quote it if the value contains spaces or shell metacharacters).","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\"`.","In scripts, build the arg safely: `wsh secret set \"${name}=${value}\"`.","Check the command's usage via `wsh secret set --help` for the [name]=[value] syntax."],"exampleFix":"// before\nwsh secret set api_key\n// after\nwsh secret set \"api_key=sk-1234\"","handlingStrategy":"validation","validationCode":"if !strings.Contains(arg, \"=\") {\n    return fmt.Errorf(\"argument must be NAME=VALUE, got %q\", arg)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always quote the NAME=VALUE argument in shells: wsh secret set \"key=value\"","In scripts build the arg explicitly: \"${name}=${value}\"","Check `wsh secret set --help` when unsure of syntax","Never split name and value into two arguments"],"tags":["cli","validation","argument-parsing"],"backgroundTag":"invalid-cli-argument","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}