wavetermdev/waveterm · error

--active-border-color: %v

Error message

--active-border-color: %v

What it means

Identical wrapper to error 247 but for the --active-border-color flag: when the flag is provided, its value is run through validateColor and failures are prefixed with "--active-border-color: ". The wrapped inner error indicates the specific validation rule that failed.

Source

Thrown at cmd/wsh/cmd/wshcmd-setbg.go:106

	return nil
}

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

	borderColorChanged := cmd.Flags().Changed("border-color")
	activeBorderColorChanged := cmd.Flags().Changed("active-border-color")

	if borderColorChanged {
		if err := validateColor(setBgBorderColor); err != nil {
			return fmt.Errorf("--border-color: %v", err)
		}
	}
	if activeBorderColorChanged {
		if err := validateColor(setBgActiveBorderColor); err != nil {
			return fmt.Errorf("--active-border-color: %v", err)
		}
	}

	// Create base metadata
	meta := map[string]interface{}{}

	// Handle opacity-only change or clear
	if len(args) == 0 {
		if !cmd.Flags().Changed("opacity") && !setBgClear && !borderColorChanged && !activeBorderColorChanged {
			OutputHelpMessage(cmd)
			return fmt.Errorf("setbg requires an image path or color value")
		}
		if setBgOpacity < 0 || setBgOpacity > 1 {
			return fmt.Errorf("opacity must be between 0.0 and 1.0")
		}
		if setBgClear {
			meta["bg:*"] = true
		} else if cmd.Flags().Changed("opacity") {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Quote and use full hex: `wsh setbg --active-border-color '#3366FF'`.
  2. Or a CSS color name: `--active-border-color blue`.
  3. Read the wrapped cause after the prefix for the exact rule violated.

Example fix

// before
wsh setbg --active-border-color '#3366f'  
// after
wsh setbg --active-border-color '#3366FF'
Defensive patterns

Strategy: validation

Validate before calling

if abc := flags["--active-border-color"]; abc != "" && !isAcceptableColor(abc) {
    return fmt.Errorf("--active-border-color %q invalid: use '#RRGGBB', '#RRGGBBAA', or a CSS name", abc)
}

Type guard

func isAcceptableColor(c string) bool {
    if strings.HasPrefix(c, "#") { return regexp.MustCompile(`^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$`).MatchString(c) }
    return CssColorNames[strings.ToLower(c)]
}

Try / catch

if err := run(); err != nil {
    if strings.Contains(err.Error(), "--active-border-color") { /* correct the active-border-color value */ }
}

Prevention

When it happens

Trigger: Any `wsh setbg --active-border-color <invalid>` invocation where the value is not '#' hex (6 or 8 digits) nor a CSS color name.

Common situations: Same as border-color mistakes: missing '#', 3-digit hex, non-hex digits, unknown color names.

Related errors


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