AprilNEA/OpenLogi · error

unknown control ( )

Error message

unknown control {raw:?} ({})

What it means

Thrown by `parse_control` in the camera CLI when the given control name (lowercased) matches neither any `CameraControl::ALL` name nor any `AutoToggle::ALL` name. The message echoes the raw input and lists every accepted name pipe-separated, so it doubles as inline help. It is a pure name-resolution failure — no hardware is touched.

Solutions

  1. Copy a control name exactly from the error's parenthesized list — it enumerates every valid name.
  2. Check for typos and use the exact spelling shown (names are compared after ASCII-lowercasing).
  3. If the control genuinely isn't listed, the CLI's catalog doesn't expose it; use a different control or extend `CameraControl::ALL` upstream.

Example fix

// before: guessed name
$ openlogi camera set exposure_time 120
// error: unknown control "exposure_time" (brightness|contrast|...)
// after: use a listed name
$ openlogi camera set exposure 120
Defensive patterns

Strategy: validation

Validate before calling

// resolve the name against the same catalogs the CLI uses before invoking set
let names: Vec<&str> = CameraControl::ALL.iter().map(|c| c.name())
    .chain(AutoToggle::ALL.iter().map(|t| t.name())).collect();
if !names.contains(&raw.as_str()) {
    eprintln!("unknown control {raw:?}; valid: {}", names.join("|"));
}

Try / catch

// treat parse_control failure as usage error, not runtime failure
let control = match parse_control(&raw) {
    Ok(c) => c,
    Err(e) => { eprintln!("{e:#}"); std::process::exit(2); } // exit code 2 = usage
};

Prevention

When it happens

Trigger: Running `openlogi camera set <name> <value>` where `<name>` is misspelled, uses the wrong case convention beyond the ASCII-lowercase normalization (e.g. contains spaces or hyphens instead of the canonical form), or names a control that does not exist in this build's catalog.

Common situations: Typo like `brighness` instead of `brightness`; guessing names from UVC terminology (e.g. `white_balance_temperature`) instead of the CLI's shorter catalog names; scripting against an older CLI version whose control catalog differed.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of AprilNEA/OpenLogi@e846e6f4b4 (2026-09-13). Data as JSON: /api/errors/941171783dacda04. Report an issue: GitHub.

Appendix: source

Thrown at crates/openlogi-cli/src/cmd/camera.rs:100

                openlogi_camera::set_control(&uid, control, value).map_err(|e| anyhow!("{e}"))?;
                println!("set {} = {value}", control.name());
            }
        }
    }
    Ok(())
}

fn parse_control(raw: &str) -> Result<CameraControl> {
    CameraControl::ALL
        .into_iter()
        .find(|c| c.name() == raw)
        .ok_or_else(|| {
            let names: Vec<&str> = CameraControl::ALL
                .iter()
                .map(|c| c.name())
                .chain(AutoToggle::ALL.iter().map(|t| t.name()))
                .collect();
            anyhow!("unknown control {raw:?} ({})", names.join("|"))
        })
}

View on GitHub (pinned to e846e6f4b4)