zeroclaw-labs/zeroclaw · error · anyhow::Error

SOP not found: {n}

Error message

SOP not found: {n}

What it means

The sop validate command with --name filters loaded SOPs by exact, case-sensitive equality on s.name. If no loaded SOP matches the given name, targets is empty and validation aborts with this error. Without --name an empty set prints a friendly 'nothing to validate' message instead.

Source

Thrown at src/sop/mod.rs:63

                            .iter()
                            .map(ToString::to_string)
                            .collect::<Vec<_>>()
                            .join(", "),
                    );
                }
            }
            println!();
            Ok(())
        }
        crate::SopCommands::Validate { name } => {
            let targets: Vec<_> = match &name {
                Some(n) => sops.iter().filter(|s| s.name == *n).collect(),
                None => sops.iter().collect(),
            };

            if targets.is_empty() {
                if let Some(n) = &name {
                    anyhow::bail!("SOP not found: {n}");
                }
                println!("{}", get_required_cli_string("cli-sop-none-to-validate"));
                return Ok(());
            }

            let mut any_warnings = false;
            for sop in &targets {
                let warnings = validate_sop(sop);
                if warnings.is_empty() {
                    println!(
                        "  {}",
                        get_required_cli_string_with_args("cli-sop-valid", &[("name", &sop.name)])
                    );
                } else {
                    any_warnings = true;
                    println!(
                        "  {}",
                        get_required_cli_string_with_args(

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Run the sop list command and copy the exact name (bold white, first column) from its output
  2. Correct typos, casing, and stray whitespace in the --name argument
  3. Confirm the SOP file is in the location the CLI scans and loads successfully (check for load errors at startup)

Example fix

# before
zeroclaw sop validate --name deploy-prod   # actual name is Deploy-Prod
# after
zeroclaw sop validate --name Deploy-Prod
Defensive patterns

Strategy: validation

Validate before calling

# confirm the exact name exists before validating
name="Deploy-Prod"
zeroclaw sop list | grep -Fqx "  $name" || { echo "no SOP named '$name'" >&2; exit 1; }
zeroclaw sop validate --name "$name"

Prevention

When it happens

Trigger: Running sop validate --name X where X differs by typo, casing, or whitespace from the SOP's declared name field; the SOP file exists on disk but is not being loaded (wrong directory, disabled, parse skipped).

Common situations: Renaming an SOP file but not its name field; copy-pasting display names with different casing from docs; SOPs living outside the scanned SOP directory; trailing spaces in names.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/7fee92e4cbd3f2ad. Report an issue: GitHub.