slimtoolkit/slim · error
missing command
Error message
missing command
What it means
runControlCommand implements the `sensor control <command>` CLI. A control invocation must include a command name as os.Args[2]; if the process was invoked with fewer args, there is no command to dispatch and it returns this error.
Source
Thrown at pkg/app/sensor/app.go:305
func dumpAppBom() {
info := appbom.Get()
if info == nil {
return
}
var out bytes.Buffer
encoder := json.NewEncoder(&out)
encoder.SetEscapeHTML(false)
encoder.SetIndent(" ", " ")
_ = encoder.Encode(info)
fmt.Printf("%s\n", out.String())
}
// 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)
}
View on GitHub (pinned to 81940d17fa)
Solutions
- Pass the control subcommand: sensor control stop-target-app
- Check the calling script/hook builds argv correctly (command at index 2)
- Run `sensor control` help/docs to see valid subcommands
Example fix
// before sensor control // after sensor control stop-target-app
Defensive patterns
Strategy: validation
Validate before calling
if len(os.Args) < 3 { return errors.New("usage: sensor control <command>") } Try / catch
if err := runControlCommand(ctx); err != nil && strings.Contains(err.Error(), "missing command") {
fmt.Fprintln(os.Stderr, "usage: sensor control <stop-target-app|wait-for-event|...>")
os.Exit(2)
} Prevention
- Quote full command lines in scripts so args aren't dropped
- Check argv length before spawning the sensor control binary
- Document subcommands in lifecycle hook configs
When it happens
Trigger: Running `sensor control` (or `sensor control` with only the mode arg) without a subcommand such as stop-target-app or wait-for-event.
Common situations: Hand-typing the control command and forgetting the subcommand; a script building the command line drops an argument; lifecycle hook configured with an empty command list.
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
- missing event name
- unknown sensor mode
- error stopping target app: %w
- error waiting for sensor event: %w
- unknown command: %s
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/0772e97cf54fef1b.
Report an issue: GitHub.