AprilNEA/OpenLogi · error

--id must be a nonempty synthetic path component

Error message

--id must be a nonempty synthetic path component

What it means

The `openlogi fixture contribute` command refuses an `--id` that is empty or only whitespace, or the special path components "." or "..". The id is used as a synthetic fixture directory name and profile id, so it must be a real, nonempty path component. The check runs up front in `validate_args` before any files are touched.

Solutions

  1. Pass a nonempty, descriptive id, e.g. `--id my-mouse-fixture`.
  2. If the id comes from a variable, verify it is set and non-blank before invoking the command: `[ -n "${ID//[[:space:]]/}" ] || exit 1`.
  3. Never use "." or ".."; choose a distinct component name for the fixture output directory.

Example fix

// before
openlogi fixture contribute --id "$ID" --name "Mouse" --output ./out
// after
ID="${ID:?--id must be set to a nonempty synthetic path component}"
openlogi fixture contribute --id "$ID" --name "Mouse" --output "./out/$ID"
Defensive patterns

Strategy: validation

Validate before calling

if [ -z "${ID//[[:space:]]/}" ] || [ "$ID" = "." ] || [ "$ID" = ".." ]; then echo "--id must be a nonempty path component" >&2; exit 1; fi

Prevention

When it happens

Trigger: Run `openlogi fixture contribute` with `--id ""`, `--id " "`, `--id .`, or `--id ..` (or a value that trims to empty). Any of these bails immediately from validate_args.

Common situations: Shell variable interpolation producing an empty string (`--id "$ID"` with unset ID), scripts passing placeholders, or someone literally trying `--id .` to write into the current directory.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at crates/openlogi-cli/src/cmd/fixture/contribute.rs:447

                && left_product == right_product
                && left_page == right_page
                && left_usage == right_usage
        }
        _ => false,
    };
    if matches {
        Ok(())
    } else {
        bail!(
            "the selected direct-capture target does not match the profile transport and slot; \
             reconnect the same device and use the same --device selector"
        )
    }
}

fn validate_args(args: &ContributeArgs) -> Result<()> {
    if args.id.trim().is_empty() || matches!(args.id.as_str(), "." | "..") {
        bail!("--id must be a nonempty synthetic path component");
    }
    if Path::new(&args.id).file_name() != Some(OsStr::new(&args.id))
        || args.id.contains('/')
        || args.id.contains('\\')
    {
        bail!("--id must be one synthetic path component without separators");
    }
    if args.name.trim().is_empty() {
        bail!("--name must be a nonempty synthetic device name");
    }
    if args.output.file_name() != Some(OsStr::new(&args.id)) {
        bail!("--output directory name must exactly equal --id");
    }
    Ok(())
}

fn validate_state(args: &ContributeArgs, state: &ContributionState) -> Result<()> {
    if state.version != STATE_VERSION {

View on GitHub (pinned to e846e6f4b4)