vectordotdev/vector · error

must be a relative descendant of the repository

Error message

{description} must be a relative descendant of the repository: {}

What it means

Guard inside resolve_repo_relative_path: while walking the components() of a user-supplied path, any ParentDir, RootDir, or Prefix component is rejected because such a path can escape the repository root (absolute paths, '../' traversal, or Windows drive prefixes). The {description} names which input was at fault; only strictly relative descendants composed of Normal components are accepted.

Solutions

  1. Pass a path relative to the repository root without leading '/' or '..' segments
  2. If an absolute path was given, strip the repository-root prefix first
  3. Re-run vdev from the repository root so relative paths resolve as intended
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vdev/src/utils/paths.rs:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at vdev/src/utils/paths.rs:57

                "Could not find Vector repository root. Please run vdev from within the Vector repository."
            );
        }
    }
}

/// Resolve a user-provided path only when it stays below the repository root.
pub fn resolve_repo_relative_path(
    repo_root: &Path,
    path: &Path,
    description: &str,
) -> Result<PathBuf> {
    let mut relative = PathBuf::new();
    for component in path.components() {
        match component {
            Component::Normal(component) => relative.push(component),
            Component::CurDir => {}
            Component::ParentDir | Component::RootDir | Component::Prefix(_) => {
                bail!(
                    "{description} must be a relative descendant of the repository: {}",
                    path.display()
                );
            }
        }
    }

    if relative.as_os_str().is_empty() {
        bail!(
            "{description} must not be the repository root: {}",
            path.display()
        );
    }

    let output = repo_root.join(relative);
    let canonical_root = repo_root.canonicalize().with_context(|| {
        format!(
            "Could not canonicalize repository root {}",

View on GitHub (pinned to 0d4ab78a4f)