{"record":{"id":"c62c382952b1c8f3","repo":"vectordotdev/vector","slug":"slug-must-not-be-empty","errorCode":null,"errorMessage":"slug must not be empty","messagePattern":"slug must not be empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/changelog/new.rs","lineNumber":78,"sourceCode":"            .with_context(|| format!(\"failed to run `git add {}`\", file.display()))?;\n        if !status.success() {\n            bail!(\n                \"wrote {} but `git add` failed — stage it manually before running `vdev check changelog-fragments`.\",\n                file.display()\n            );\n        }\n\n        info!(\"Created {}\", relative(&repo_root, &file).display());\n        info!(\"Edit the file, then run `vdev check changelog-fragments` to validate.\");\n        Ok(())\n    }\n}\n\n/// A slug must be one filename component: ASCII alnum, `_`, or `-` only.\n/// Rejects path separators, `..`, absolute paths, and anything with punctuation.\nfn validate_slug(slug: &str) -> Result<()> {\n    if slug.is_empty() {\n        bail!(\"slug must not be empty\");\n    }\n    if !slug\n        .chars()\n        .all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-')\n    {\n        bail!(\n            \"invalid slug '{slug}': only ASCII letters, digits, '_', and '-' are allowed (got a path separator or punctuation?)\"\n        );\n    }\n    Ok(())\n}\n\nfn render_template(fragment_type: &FragmentType, author: &str) -> String {\n    if fragment_type.breaking {\n        formatdoc! {\"\n            # TODO one-line title\n\n            ## Summary","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/changelog/new.rs#L60-L96","documentation":"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.","triggerScenarios":"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).","commonSituations":"Scripted usage where the slug comes from an unset/empty environment variable or from a failed parse of some other command's output.","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"],"exampleFix":"// before\nvdev changelog new bug_fix \"$SLUG\"   # SLUG=\"\"\n// after\n: \"${SLUG:?SLUG must be set}\"\nvdev changelog new bug_fix \"$SLUG\"","handlingStrategy":"validation","validationCode":"if (!slug) throw new Error(\"slug must not be empty\");","typeGuard":"function isNonEmptyString(v) { return typeof v === \"string\" && v.length > 0; }","tryCatchPattern":"try { runVdevNew(type, slug); } catch (e) { if (/slug must not be empty/.test(e.message)) slug = defaultSlug(); ... }","preventionTips":["Use `${VAR:?}` guards for shell-supplied slugs","Validate CLI args in wrapper scripts before exec","Fail fast in CI when derived slugs are empty"],"tags":["cli","validation"],"backgroundTag":"empty-required-field","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}