Another fun rule graph error - that shows up on th...
# development
w
Another fun rule graph error - that shows up on the Pants main repo, when trying to run anything - but doesn't show up when I use
pants_from_sources
on my plugins repo.
Copy code
⏺ oss/pants-peek % pants --version                                                                                                                                                                                                                                                                        ⎇ peek-goals*
16:57:03.38 [INFO] Initializing scheduler...
16:57:06.38 [ERROR] Encountered 12 rule graph errors:
  No installed rules return the type BuildTargetIdentifier, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type BuildTargetIdentifier, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type Specs, and it was not provided by potential callers of @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type TargetRootsToFieldSetsRequest, and it was not provided by potential callers of @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type _ParseOneBSPMappingRequest, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:137:parse_one_bsp_mapping(_ParseOneBSPMappingRequest) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type _ParseOneBSPMappingRequest, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:137:parse_one_bsp_mapping(_ParseOneBSPMappingRequest) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No source of dependency BSPBuildTargets for @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal). All potential sources were eliminated: []
  No source of dependency BSPBuildTargets for @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal). All potential sources were eliminated: []
  No source of dependency Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest]) for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []
  No source of dependency Get(FilteredTargets, [Specs]) for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []
  No source of dependency RegisteredTargetTypes for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []
  No source of dependency UnionMembership for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []
Traceback (most recent call last):
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/bin/daemon_pants_runner.py", line 133, in single_daemonized_run
    scheduler, options_initializer = self._core.prepare(options_bootstrapper, complete_env)
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/pantsd/pants_daemon_core.py", line 176, in prepare
    self._initialize(
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/pantsd/pants_daemon_core.py", line 119, in _initialize
    raise e
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/pantsd/pants_daemon_core.py", line 109, in _initialize
    self._scheduler = EngineInitializer.setup_graph(
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/init/engine_initializer.py", line 198, in setup_graph
    return EngineInitializer.setup_graph_extended(
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/init/engine_initializer.py", line 341, in setup_graph_extended
    scheduler = Scheduler(
  File "/Users/sj/Developer/oss/pants-peek/src/python/pants/engine/internals/scheduler.py", line 218, in __init__
    self._py_scheduler = native_engine.scheduler_create(
ValueError: Encountered 12 rule graph errors:
  No installed rules return the type BuildTargetIdentifier, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type BuildTargetIdentifier, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type Specs, and it was not provided by potential callers of @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type TargetRootsToFieldSetsRequest, and it was not provided by potential callers of @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type _ParseOneBSPMappingRequest, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:137:parse_one_bsp_mapping(_ParseOneBSPMappingRequest) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No installed rules return the type _ParseOneBSPMappingRequest, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:137:parse_one_bsp_mapping(_ParseOneBSPMappingRequest) -> BSPBuildTargetInternal).
    If that type should be computed by a rule, ensure that that rule is installed.
    If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
  No source of dependency BSPBuildTargets for @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal). All potential sources were eliminated: []
  No source of dependency BSPBuildTargets for @rule(pants.bsp.util_rules.targets:215:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal). All potential sources were eliminated: []
  No source of dependency Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest]) for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []
  No source of dependency Get(FilteredTargets, [Specs]) for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []
  No source of dependency RegisteredTargetTypes for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []
  No source of dependency UnionMembership for @rule(pants.engine.internals.specs_rules:482:find_valid_field_sets_for_target_roots(TargetRootsToFieldSetsRequest, Specs, UnionMembership, RegisteredTargetTypes) -> TargetRootsToFieldSets, gets=[Get(FilteredTargets, [Specs]), Get(FieldSetsPerTarget, [FieldSetsPerTargetRequest])]). All potential sources were eliminated: []

Use -ldebug for more logs. 
See <https://www.pantsbuild.org/v2.17/docs/troubleshooting> for common issues.
Consider reaching out for help: <https://www.pantsbuild.org/v2.17/docs/getting-help>
I think I'm just surprised that it works on one and not the other - but maybe I've unlocked just the right backends in the plugins repo, which aren't enabled in the main repo?
Or, maybe not - only
Copy code
backend_packages = [
    "pants.backend.python",
]
is enabled, and my code works 🤷
c
Do you introduce a new union type?
w
Not intentionally 🙂 I call
Copy code
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]
which is where I guess the funny business happens, but I don't understand why it works as
./pants_from_sources
but not in that same pants repo
c
Hep.
w
A lot of those graph errors seem to mention just regular stuff from
pants.engine.targets
interesting... A lot of the rules that are missing are in the
engine_initializer.py
- I wonder if that's relevant