langchain-ai/deepagents · error · CompositeExtraConflictError

Extra {extra!r} is also provided by {listed} and cannot be r

Error message

Extra {extra!r} is also provided by {listed} and cannot be removed independently. Remove that extra instead, then reinstall the extras you want individually.

What it means

Raised when the extra being removed is also supplied by another selected extra (a composite/overlapping extra), so it cannot be removed on its own. The library inspects the currently selected uv tool extras and refuses independent removal to avoid breaking the composite extra. You must remove the composite extra instead.

Source

Thrown at libs/code/deepagents_code/update_check.py:3797

    the `--with` packages.
    """
    if not is_valid_extra_name(extra):
        msg = (
            f"Invalid extra name {extra!r}: must match PEP 508 "
            f"({_EXTRA_NAME_RE.pattern})"
        )
        raise ValueError(msg)
    from deepagents_code.extras_info import BASE_DEPENDENCY_EXTRAS

    selected_extra = canonicalize_name(extra)
    if selected_extra in BASE_DEPENDENCY_EXTRAS:
        msg = f"Extra {extra!r} is a base dependency and cannot be removed."
        raise ProtectedExtraError(msg)

    extras = _uv_tool_selected_extras(distribution_name=distribution_name)
    conflict = _composite_extra_conflict_message(extra, selected=extras)
    if conflict is not None:
        raise CompositeExtraConflictError(conflict)
    if selected_extra not in extras:
        listed = ", ".join(sorted(extras)) or "(none)"
        msg = f"Extra {extra!r} is not installed. Selected extras: {listed}"
        raise ExtraNotInstalledError(msg)
    return _uv_tool_install_command(
        version=version,
        include_prereleases=_resolve_include_prereleases(
            None, installed=_parse_version(version)
        ),
        distribution_name=distribution_name,
        extras_to_remove=(selected_extra,),
        reinstall=True,
    )


def _composite_extra_conflict_message(
    extra: str,
    *,

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Remove the composite/bundle extra named in the message (Remove that extra instead), then reinstall only the individual extras you want.
  2. List currently selected extras (e.g. `uv tool list --show-extras` or the library's selected-extras helper) to identify the owning bundle.
  3. Update your install scripts to express the desired set as individual extras instead of a bundle.

Example fix

// before
remove_extra('search-tools')  # provided by bundle 'all'
// after
remove_extra('all')
install_extra('search-tools')
Defensive patterns

Strategy: validation

Validate before calling

from deepagents_code.update_check import _composite_extra_conflict_message, _uv_tool_selected_extras
conflict = _composite_extra_conflict_message(name, selected=_uv_tool_selected_extras(distribution_name=dist))
if conflict:
    print('remove the bundle extra instead:', conflict)

Try / catch

try:
    remove_extra(name)
except CompositeExtraConflictError as e:
    owner = extract_provider_from_message(str(e))
    remove_extra(owner)  # remove bundle, then reinstall desired individuals

Prevention

When it happens

Trigger: Calling the remove-extra API (update_check.py) with an extra that appears in the provider set of another installed extra, as detected by _composite_extra_conflict_message against the extras reported by _uv_tool_selected_extras.

Common situations: Extras like 'all' or feature bundles that pull in sub-extras; after installing a bundle extra, trying to remove one of its members individually; version changes that moved an extra into a bundle.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/c6c4c2f54d071ad4. Report an issue: GitHub.