<#18348 Using `overrides` with incorrect field val...
# github-notifications
q
#18348 Using `overrides` with incorrect field values isn't caught immediately, and leads to confusing downstream errors Issue created by huonw Describe the bug If a target generator has some of its generated targets customised via
overrides
, it seems like the overrides values aren't validated in the same way as providing them directly to a normal target. This can lead to weird downstream errors that are hard to debug (e.g. https://pantsbuild.slack.com/archives/C046T6T9U/p1677030322791399?thread_ts=1677027041.399219&amp;cid=C046T6T9U). Reproducer: https://gist.github.com/huonw/9c62ef32d71751af21be957ac794d67b
Copy code
git clone <https://gist.github.com/9c62ef32d71751af21be957ac794d67b.git>
cd 9c62ef32d71751af21be957ac794d67b

pants dependencies ::
# UnsupportedWildcardError: The address `:` from the `dependencies` field from the target //:reqs#requests ended in a wildcard (`:`), which is not supported.
BUILD
file (the
dependencies="..."
should be
dependencies=["..."]
):
Copy code
# Using overrides:
python_requirements(
    name="reqs", overrides={"requests": dict(dependencies=":reqs#setuptools")}
)
#> error: UnsupportedWildcardError: The address `:` from the `dependencies` field from the target //:reqs#requests ended in a wildcard (`:`), which is not supported.

# Equivalent manual targets:
# python_requirement(name="setuptools", requirements=["setuptools"])
# python_requirement(name="requests", requirements=["requests"], dependencies=":setuptools")
#> error: InvalidFieldTypeException: The 'dependencies' field in target //:requests must be an iterable of strings (e.g. a list of strings), but was `':setuptools'` with type `str`.
The error message hints at the problem ("the address `:`" comes from the string
":reqs#setuptools"
being treated as an iterable equivalent to
[":", "r", "e", ...]
), but is far less useful than being really specific about the problem, like the equivalent `python_requirement`s are. Pants version 2.14.0, 2.15.0rc7, 2.16.0.dev7 OS macOS Additional info Add any other information about the problem here, such as attachments or links to gists, if relevant. pantsbuild/pants