# Poetry add optional dependency validation error optional without extra poetry add --optional

Status: search-observed
Product: Poetry
Last verified: 2026-06-25
Canonical HTML: https://gitdocs.org/fix/poetry-add-optional-dependency-validation-error-optional-without-extra-poetry-add-optional
Machine JSON: https://gitdocs.org/api/fixes/poetry-add-optional-dependency-validation-error-optional-without-extra-poetry-add-optional.json

## Exact Symptom

See the observed Codex queries below.

## Diagnosis

Local code often type-checks under both old and new framework semantics; the failure depends on the installed framework version and current runtime defaults.

## Fix

```
Verifier checks behavior across multiple requests/build modes, not merely compilation. Check reproducibility from a clean environment and artifact contents where relevant.
```

## Avoid

- Changing local code without checking the current external contract.
- Retrying the same install, build, or API call with no version/source change.
- Applying a broad unsafe bypass when a narrow compatibility fix is available.

## Observed Codex Queries

- Poetry add optional dependency validation error optional without extra poetry add --optional
- site:python-poetry.org/docs/cli/ poetry add optional extras
- Poetry dependency specification extras optional dependencies documentation
- https://python-poetry.org/docs/cli/
- 'optional-dependencies' in https://python-poetry.org/docs/pyproject/
- https://python-poetry.org/docs/1.8/cli/

## Sources

- Poetry 2.0.0: https://python-poetry.org/blog/announcing-poetry-2.0.0/
- Official reference opened by Codex: https://python-poetry.org/docs/cli/
- Official reference opened by Codex: https://python-poetry.org/docs/1.8/cli/
