vectordotdev/vector · error
already exists
Error message
{} already exists What it means
`vdev changelog new` refuses to overwrite an existing fragment. In `New::exec` (vdev/src/commands/changelog/new.rs:30), after building the target path `changelog.d/<slug>.<type>.md`, it checks `file.exists()` and bails with "<path> already exists" if a fragment with the same slug and type is already present.
Solutions
- Choose a different, more specific slug (e.g. include a ticket number).
- Edit the existing `changelog.d/<slug>.<type>.md` file instead of creating a new one.
- Delete the existing fragment first if it was created by mistake, then re-run the command.
Example fix
// before vdev changelog new fix-bug error # changelog.d/fix-bug.error.md exists // after vdev changelog new fix-bug-12345 error
Defensive patterns
Strategy: validation
Validate before calling
let path = format!("changelog.d/{slug}.{fragment_type}.md");
if std::path::Path::new(&path).exists() {
eprintln!("fragment already exists at {path}; edit it or pick another slug");
} Try / catch
if let Err(e) = changelog_new::New { slug, fragment_type }.exec() {
eprintln!("{e:#}"); // includes the conflicting file path
} Prevention
- Use unique, specific slugs (ticket/issue number) to avoid collisions.
- Check `ls changelog.d/` before creating a fragment.
- Edit the existing fragment instead of creating a duplicate.
When it happens
Trigger: Running `vdev changelog new <slug> <type>` when `changelog.d/<slug>.<type>.md` already exists — e.g. re-running the command after a previous successful run, or reusing a slug that collides with an existing fragment.
Common situations: Re-running the command after an interrupted session where the file was already written; picking a generic slug (like `fix-bug`) that another contributor already used; scripting the command idempotently without checking existence.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- does not exist
- Changelog fragment has unrecognized type ' ' (valid types: )
- Changelog fragment is invalid (filename must be . .md)
- Could not parse
- Failed to get metadata for
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/123e7873764f0e48.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/changelog/new.rs:40
FRAGMENT_TYPES.iter().map(|t| t.name)
))]
fragment_type: String,
/// Unique slug (used as the filename prefix, e.g. `env_var_interpolation`).
slug: String,
}
impl Cli {
pub fn exec(self) -> Result<()> {
validate_slug(&self.slug)?;
let repo_root = paths::find_repo_root()?;
let dir = repo_root.join(CHANGELOG_DIR);
if !dir.is_dir() {
bail!("{} does not exist", dir.display());
}
let file = dir.join(format!("{}.{}.md", self.slug, self.fragment_type));
if file.exists() {
bail!("{} already exists", file.display());
}
let author = detect_gh_handle().unwrap_or_else(|| TODO_HANDLE.to_string());
let Some(entry) = FRAGMENT_TYPES
.iter()
.find(|t| t.name == self.fragment_type.as_str())
else {
bail!("unknown fragment type '{}'", self.fragment_type);
};
let content = render_template(entry, &author);
fs::write(&file, content)?;
// `git add` the new fragment so the checker (which scans `git diff --diff-filter=A`)
// picks it up immediately without a manual staging step. Report the failure if it
// happens — the file is on disk, but the checker won't see it until it's staged.
let status = Command::new("git")
.args(["add", "--"])
.arg(&file)View on GitHub (pinned to bdb87aeaa4)