https://pantsbuild.org/ logo
#development
Title
# development
w

wide-midnight-78598

04/06/2023, 5:07 PM
Am I getting this
KeyError: <class 'pants.core.goals.deploy.DeployFieldSet'>
error because my project doesn't currently have any targets that use Deploy?
Copy code
peekable_field_sets = [PackageFieldSet, TestFieldSet, DeployFieldSet]
        target_roots_to_field_sets_get = [Get(
            TargetRootsToFieldSets,
            TargetRootsToFieldSetsRequest(
                field_set_superclass=fs,
                goal_description="",
                no_applicable_targets_behavior=NoApplicableTargetsBehavior.ignore,
            ),
        ) for fs in peekable_field_sets]
Copy code
Traceback (most recent call last):
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
    res = rule.send(arg) if err is None else rule.throw(throw or err)
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/backend/project_info/peek.py", line 322, in peek
    tds = await Get(TargetDatas, UnexpandedTargets, targets)
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/selectors.py", line 118, in __await__
    result = yield self
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
    res = rule.send(arg) if err is None else rule.throw(throw or err)
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/backend/project_info/peek.py", line 277, in get_target_data
    package_targets_to_field_sets, test_targets_to_field_sets = await MultiGet(target_roots_to_field_sets_get)
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/selectors.py", line 358, in MultiGet
    return await _MultiGet(tuple(__arg0))
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/selectors.py", line 165, in __await__
    result = yield self.gets
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
    res = rule.send(arg) if err is None else rule.throw(throw or err)
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/specs_rules.py", line 500, in find_valid_field_sets_for_target_roots
    field_set_types=union_membership[request.field_set_superclass],
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/unions.py", line 134, in __getitem__
    return self.union_rules[union_type]  # type: ignore[return-value]
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/util/frozendict.py", line 77, in __getitem__
    return self._data[k]
KeyError: <class 'pants.core.goals.deploy.DeployFieldSet'>
Okay, yeah, looks like if I add
pants.backend.experimental.helm
- that KeyError goes away. Definitely feels like a bug - especially if the API has a field called
no_applicable_targets_behavior=NoApplicableTargetsBehavior.ignore,
The issue is that this
UnionMembership
doesn't contain a
DeployFieldSet
(obviously) and it throws the keyerror