vectordotdev/vector · error

expected a deprecation slug (e.g…

Error message

expected a deprecation slug (e.g. "azure-monitor-logs-sink"), not a path: {}

What it means

Thrown by `cargo vdev deprecation enact` (exec) when the slug argument contains a path separator ('/' or '\\'). The command expects a bare deprecation slug (optionally with .md suffix) so the identifier stays unambiguous and the file lookup remains safe (path-traversal guard).

Solutions

  1. Pass only the slug: `cargo vdev deprecation enact azure-monitor-logs-sink`.
  2. Strip directories and the .md extension from the path before invoking.
  3. Run from the repo root and let the command resolve the fragment directory itself.
  4. Use shell tab-completion on fragment names, not file paths.

Example fix

// before
cargo vdev deprecation enact changelog.d/azure-monitor-logs-sink.md
// after
cargo vdev deprecation enact azure-monitor-logs-sink
Defensive patterns

Strategy: validation

Validate before calling

let slug = "changelog.d/azure-monitor-logs-sink.md";
let slug = std::path::Path::new(slug).file_stem().unwrap().to_str().unwrap();
assert!(!slug.contains('/') && !slug.contains('\\'), "pass a bare slug, not a path");

Type guard

fn is_bare_slug(s: &str) -> bool { !s.is_empty() && !s.contains('/') && !s.contains('\\') }

Try / catch

match result { Err(e) if e.to_string().contains("not a path") => { eprintln!("Use just the slug, e.g. azure-monitor-logs-sink"); } Err(e) => return Err(e), Ok(v) => v }

Prevention

When it happens

Trigger: Running `cargo vdev deprecation enact path/to/fragment` or `enact ..\\fragment` — any slug where self.slug.contains('/') or contains('\\').

Common situations: Users paste a full file path or relative path copied from an editor or shell completion instead of just the fragment slug like azure-monitor-logs-sink.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/084b59fe60bbda8b. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/deprecation/enact.rs:29

pub struct Cli {
    /// Filename (slug) in deprecation.d/ to enact, e.g. "azure-monitor-logs-sink"
    slug: String,

    /// The Vector version in which this feature was removed, e.g. "0.58.0".
    /// Defaults to the next minor after the latest git tag.
    #[arg(long)]
    version: Option<Version>,
}

impl Cli {
    pub fn exec(self) -> Result<()> {
        let repo_root = paths::find_repo_root()?;
        let dir = repo_root.join(deprecation::DEPRECATION_DIR);

        // Accept "slug" or "slug.md"; reject path-like inputs to keep the
        // identifier unambiguous (and the file lookup safe).
        if self.slug.contains('/') || self.slug.contains('\\') {
            bail!(
                "expected a deprecation slug (e.g. \"azure-monitor-logs-sink\"), not a path: {}",
                self.slug
            );
        }
        let stem = self.slug.strip_suffix(".md").unwrap_or(&self.slug);
        let filename = format!("{stem}.md");

        let path = dir.join(&filename);
        if !path.exists() {
            bail!("No deprecation fragment found at {}", path.display());
        }

        // Parse the fragment to get entry data.
        let entries = deprecation::read_deprecation_fragments(&dir)?;
        let entry = entries
            .into_iter()
            .find(|e| e.filename == filename)
            .ok_or_else(|| anyhow::anyhow!("Could not parse {filename}"))?;

View on GitHub (pinned to bdb87aeaa4)