Fix a Commitlint Conventional Commit Failure
Rewrite failed commitlint subjects into valid Conventional Commit messages with the right type, scope, subject, and breaking-change footer.
Direct answer
To fix a commitlint failure, rewrite the subject as `type(scope): imperative subject` using a known lowercase type, an optional lowercase scope, and a concise subject without a period. If the change is incompatible, add `!` after the type or scope and include a `BREAKING CHANGE:` footer. Paste the failed subject, the commitlint error, and what actually changed into the generator.
Open Conventional Commit GeneratorWhen to use this
- CI failed with commitlint or commit message validation.
- Your commit subject is vague, missing a type, too long, or uses an invalid type.
- You need to amend or squash commits before pushing or merging.
Steps
- Copy the failed commit subject and the commitlint error.
- Describe the actual code, docs, test, build, or CI change.
- Pick a valid Conventional Commit type and optional scope.
- Keep the subject imperative, lowercase after the colon, and short.
- Amend the commit or use the generated subject while squashing.
Example
commitlint failed: subject may not be empty, type may not be empty Failed commit: updated auth stuff Change: fixed refresh token expiry in AuthService and added a regression test.
fix(auth): refresh expired session tokens
Common mistakes
- Do not keep vague subjects like updated stuff or changes.
- Do not uppercase the type or scope if your config expects lowercase.
- Do not mark a breaking change unless users or callers must change something.
FAQ
- Why did commitlint fail?
- Common causes are missing type, invalid type, empty subject, uppercase type or scope, subject too long, or a malformed breaking-change footer.
- How do I amend the failed commit?
- After generating the corrected message, use `git commit --amend` for the latest commit or squash/reword during an interactive rebase if the bad commit is older.
- Can commitlint require custom scopes?
- Yes. Some repos restrict scopes. If your config does that, use one of the allowed scopes or omit scope when the config permits it.
Related Conventional Commit guides
Which Conventional Commit Type Should I Use?
Choose the right Conventional Commit type for feat, fix, docs, refactor, perf, test, build, ci, chore, and revert commits.
Semantic Release Conventional Commit Version Bump
Use Conventional Commits to signal patch, minor, and major releases for semantic-release, release-please, changesets, and similar tooling.
AI Coding Session Commit Message Generator
Turn a Claude Code, Codex, Cursor, Copilot, or Windsurf coding session summary into one clean Conventional Commit message.