wavetermdev/waveterm · error

badgeid is required

Error message

badgeid is required

What it means

Returned when the request requires a badgeid but none was supplied.

Source

Thrown at pkg/wshrpc/wshremote/wshremote.go:149

	if impl.IsLocal {
		return filepath.Join(wavebase.GetWaveDataDir(), "bin", "wsh"), nil
	}
	wshPath, err := wavebase.ExpandHomeDir("~/.waveterm/bin/wsh")
	if err != nil {
		return "", fmt.Errorf("cannot expand wsh path: %w", err)
	}
	return wshPath, nil
}

func (impl *ServerImpl) BadgeWatchPidCommand(ctx context.Context, data wshrpc.CommandBadgeWatchPidData) error {
	if data.Pid <= 0 {
		return fmt.Errorf("invalid pid: %d", data.Pid)
	}
	if data.ORef.IsEmpty() {
		return fmt.Errorf("oref is required")
	}
	if data.BadgeId == "" {
		return fmt.Errorf("badgeid is required")
	}
	go func() {
		defer func() {
			panichandler.PanicHandler("BadgeWatchPidCommand", recover())
		}()
		for {
			time.Sleep(time.Second)
			if unixutil.IsPidRunning(data.Pid) {
				continue
			}
			orefStr := data.ORef.String()
			event := wps.WaveEvent{
				Event:  wps.Event_Badge,
				Scopes: []string{orefStr},
				Data: baseds.BadgeEvent{
					ORef:      orefStr,
					ClearById: data.BadgeId,
				},

View on GitHub (pinned to a4447c1563)

Solutions

  1. Set a unique BadgeId when building the command data
  2. Validate BadgeId != "" in the caller before the RPC
  3. Check client/server schema versions match
Defensive patterns

Strategy: validation

Validate before calling

if data.BadgeId == "" {
    return fmt.Errorf("badgeid must be a non-empty unique identifier")
}

Try / catch

if err := BadgeWatchPidCommand(ctx, data); err != nil {
    if strings.Contains(err.Error(), "badgeid is required") {
        return fmt.Errorf("caller bug: badge watch missing badgeid")
    }
    return err
}

Prevention

When it happens

Trigger: Calling BadgeWatchPidCommand with CommandBadgeWatchPidData.BadgeId == "".

Common situations: Hand-constructed command data omitting BadgeId; older clients/versions whose payload schema lacked badgeid.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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