Zackriya-Solutions/meetily · warning

Device type (input/output) not specified in the name

Error message

Device type (input/output) not specified in the name

What it means

Thrown by AudioDevice::from_name (configuration.rs:82) when the name does not end with the literal '(input)' or '(output)' suffix (case-insensitive). The parser encodes device direction in the display name itself - the same physical device appears once per suffix in device lists - so a bare name is ambiguous and rejected rather than guessed. It is a contract error between the device-listing API and the device-lookup API.

Source

Thrown at frontend/src-tauri/src/audio/devices/configuration.rs:82

    }

    pub fn from_name(name: &str) -> Result<Self> {
        if name.trim().is_empty() {
            return Err(anyhow!("Device name cannot be empty"));
        }

        let (name, device_type) = if name.to_lowercase().ends_with("(input)") {
            (
                name.trim_end_matches("(input)").trim().to_string(),
                DeviceType::Input,
            )
        } else if name.to_lowercase().ends_with("(output)") {
            (
                name.trim_end_matches("(output)").trim().to_string(),
                DeviceType::Output,
            )
        } else {
            return Err(anyhow!(
                "Device type (input/output) not specified in the name"
            ));
        };

        Ok(AudioDevice::new(name, device_type))
    }
}

impl fmt::Display for AudioDevice {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "{} ({})",
            self.name,
            match self.device_type {
                DeviceType::Input => "input",
                DeviceType::Output => "output",
            }

View on GitHub (pinned to 0281737d87)

Solutions

  1. If the direction is known, construct directly: AudioDevice::new(name, DeviceType::Input) - no suffix parsing involved.
  2. Store and pass the full labeled string 'Device (input)'/'Device (output)' exactly as returned by list_audio_devices.
  3. When re-parsing a stored AudioDevice name, re-append the suffix from the known device_type instead of calling from_name.
  4. Normalize before parsing: re-append the suffix with format! so the name carries the expected '(input)'/'(output)' marker.

Example fix

// before: Display round-trip loses the suffix
let dev = AudioDevice::from_name("MacBook Pro Microphone")?; // Err

// after: construct with an explicit type when direction is known
let dev = AudioDevice::new("MacBook Pro Microphone".to_string(), DeviceType::Input);
Defensive patterns

Strategy: validation

Validate before calling

// Rust: ensure the suffixed form before parsing
fn ensure_suffixed(name: &str, dt: DeviceType) -> String {
    if name.to_lowercase().ends_with("(input)") || name.to_lowercase().ends_with("(output)") {
        name.to_string()
    } else {
        let dir = match dt { DeviceType::Input => "input", DeviceType::Output => "output" };
        format!("{} ({})", name, dir)
    }
}
let dev = AudioDevice::from_name(&ensure_suffixed(raw, DeviceType::Input))?;

Type guard

fn carries_device_type_suffix(name: &str) -> bool {
    let n = name.to_lowercase();
    n.ends_with("(input)") || n.ends_with("(output)")
}

Prevention

When it happens

Trigger: Calling AudioDevice::from_name("MacBook Pro Microphone") without a suffix; double-parsing a stored name (from_name strips the suffix, so from_name(from_name(x).name) loses it the second time); UI code that displays the pretty name (suffix removed by Display/serde) and feeds that displayed value back into from_name; suffix spacing variants like '( input )'.

Common situations: Round-tripping an AudioDevice through its Display representation or a serde JSON that serializes the trimmed name; a frontend dropdown storing device.name (suffix-stripped) instead of the full labeled string; version drift where an older build stored names without suffixes.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/31569a8dd4ff6dac. Report an issue: GitHub.