## TL;DR
The commit message starts with a word commitlint does not recognize. Rewrite the message with one of the allowed types, usually `fix:`, `feat:`, or `docs:`, and push again. Check the repo's config first, because the allowed list varies.

## The error
```text
commitlint failed: type must be one of [feat, fix, docs]: invalid commit type on PR
input: added retry logic to the review worker
type must be one of [feat, fix, docs, chore, refactor, test] [type-enum]
```

## Steps
### 1. Read the allowed types
Open `.commitlintrc` (or commitlint.config.js) in the repo root.
Expected output: the `type-enum` list, for example [feat, fix, docs, chore, refactor, test].

### 2. Rewrite the commit message
Run `git commit --amend -m "fix: describe what changed"` using a type from that list.
Expected output: `git log -1 --format=%s` shows the new message starting with a valid type.

### 3. Push the corrected commit
Run `git push --force-with-lease` if the bad commit was already pushed.
Expected output: the remote branch carries the corrected message.

### 4. Re-run commitlint locally to confirm
Run `npx commitlint --from main --to HEAD`.
Expected output: no errors, and the CI gate passes on the next push.

## When to use
- commitlint fails with a type-enum error on a PR commit
- The commit message uses a made-up type like `update:` or `wip:`
- A contributor's first PR trips the message gate

## When not to use
- Failures on scope, casing, or length rules (different rules, different fixes)
- Squash-merge PR title lint (fix the PR title, not the commits)
- commitlint itself crashing on a bad config file

## Tool compatibility
- commitlint v17/v18/v19 with @commitlint/config-conventional or a custom config
- Works with husky commit-msg hooks and CI lint steps
- commitizen users pick a valid type from the prompt automatically

## Variant phrasings
### commitlint scope-enum failure
Same idea, different rule: the scope in `fix(auth): ...` is not in the allowed scope list. Either use an allowed scope or drop the scope.

### commitlint subject-case failure
The subject line casing is wrong, for example uppercase when the config wants lowercase. Reword the subject; the type is fine.

### header-max-length failure
The first line is too long. Shorten the subject and move detail into the body.

## Why it happens
Conventional commits require the message to start with `type:` so tooling can parse intent for changelogs and version bumps. `added retry logic` has no type prefix, so the parser rejects it. The gate protects the changelog pipeline, not your prose style.

## Edge cases
- Squash merges: the PR title becomes the commit message, so a valid commit history can still fail if the PR title is not conventional. Fix the title.
- Multiple bad commits: use interactive rebase to reword each, or squash them into one valid message.
- Repos without a config file: commitlint falls back to defaults that may differ from what contributors expect; pin the config in the repo.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_yoPd2N1vXf1UYLQu7qvLfw
