slimtoolkit/slim · error

missing event name

Error message

missing event name

What it means

For the `sensor control wait-for-event` subcommand, the event name is expected as the next argv element (os.Args[3]). If it is absent, runControlCommand returns this error before attempting to wait.

Source

Thrown at pkg/app/sensor/app.go:318

}

// sensor control <stop-target-app|wait-for-event|change-log-level|...>
func runControlCommand(ctx context.Context) error {
	if len(os.Args) < 3 {
		return errors.New("missing command")
	}

	cmd := control.Command(os.Args[2])

	switch cmd {
	case control.StopTargetAppCommand:
		if err := control.ExecuteStopTargetAppCommand(ctx, *commandsFile); err != nil {
			return fmt.Errorf("error stopping target app: %w", err)
		}

	case control.WaitForEventCommand:
		if len(os.Args) < 4 {
			return errors.New("missing event name")
		}
		if err := control.ExecuteWaitEvenCommand(ctx, eventsFilePath(), event.Type(os.Args[3])); err != nil {
			return fmt.Errorf("error waiting for sensor event: %w", err)
		}

	default:
		return fmt.Errorf("unknown command: %s", cmd)
	}

	return nil
}

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Append the event name: sensor control wait-for-event <event-name>
  2. Ensure the event variable in your script is non-empty before invoking
  3. Use a valid event type understood by control.ExecuteWaitEvenCommand

Example fix

// before
sensor control wait-for-event
// after
sensor control wait-for-event report-ready
Defensive patterns

Strategy: validation

Validate before calling

if len(os.Args) < 4 { return errors.New("usage: sensor control wait-for-event <event-name>") }
if os.Args[3] == "" { return errors.New("event name must be non-empty") }

Try / catch

if err := runControlCommand(ctx); err != nil && strings.Contains(err.Error(), "missing event name") {
  fmt.Fprintln(os.Stderr, "usage: sensor control wait-for-event <event-name>")
  os.Exit(2)
}

Prevention

When it happens

Trigger: Running `sensor control wait-for-event` with no event name argument following the subcommand.

Common situations: Copy-pasting the command without the event name; scripts interpolating an empty event variable; forgetting which event names are valid.

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 slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/4e7be871b5027c70. Report an issue: GitHub.