vectordotdev/vector · error
slug must not be empty
Error message
slug must not be empty
What it means
Raised by validate_slug when the user-supplied slug for a new changelog fragment is the empty string. The slug becomes the filename component of the fragment file, so an empty value would produce a malformed filename like '.type.md'; the guard requires a non-empty ASCII alnum/_/- component before proceeding.
Solutions
- Supply a non-empty slug: `vdev changelog new <type> my-slug`
- In scripts, check the variable is non-empty before invoking
- If deriving the slug dynamically, add a default or fail fast when the source is empty
Example fix
// before
vdev changelog new bug_fix "$SLUG" # SLUG=""
// after
: "${SLUG:?SLUG must be set}"
vdev changelog new bug_fix "$SLUG" Defensive patterns
Strategy: validation
Validate before calling
if (!slug) throw new Error("slug must not be empty"); Type guard
function isNonEmptyString(v) { return typeof v === "string" && v.length > 0; } Try / catch
try { runVdevNew(type, slug); } catch (e) { if (/slug must not be empty/.test(e.message)) slug = defaultSlug(); ... } Prevention
- Use `${VAR:?}` guards for shell-supplied slugs
- Validate CLI args in wrapper scripts before exec
- Fail fast in CI when derived slugs are empty
When it happens
Trigger: Invoking `vdev changelog new <type> ""` or passing an empty positional slug (e.g. a shell variable that expanded to nothing: `vdev changelog new bug_fix "$SLUG"` with SLUG unset).
Common situations: Scripted usage where the slug comes from an unset/empty environment variable or from a failed parse of some other command's output.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Failed to find validation configuration from given test…
- invalid slug ' ': only ASCII letters, digits, '_', and '-'…
- release version must be a stable semantic version
- unknown fragment type
- a sink must always have an external resource
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/c62c382952b1c8f3.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/changelog/new.rs:78
.with_context(|| format!("failed to run `git add {}`", file.display()))?;
if !status.success() {
bail!(
"wrote {} but `git add` failed — stage it manually before running `vdev check changelog-fragments`.",
file.display()
);
}
info!("Created {}", relative(&repo_root, &file).display());
info!("Edit the file, then run `vdev check changelog-fragments` to validate.");
Ok(())
}
}
/// A slug must be one filename component: ASCII alnum, `_`, or `-` only.
/// Rejects path separators, `..`, absolute paths, and anything with punctuation.
fn validate_slug(slug: &str) -> Result<()> {
if slug.is_empty() {
bail!("slug must not be empty");
}
if !slug
.chars()
.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-')
{
bail!(
"invalid slug '{slug}': only ASCII letters, digits, '_', and '-' are allowed (got a path separator or punctuation?)"
);
}
Ok(())
}
fn render_template(fragment_type: &FragmentType, author: &str) -> String {
if fragment_type.breaking {
formatdoc! {"
# TODO one-line title
## SummaryView on GitHub (pinned to bdb87aeaa4)