Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when using macro in root BUILD file #19156

Closed
thejcannon opened this issue May 25, 2023 · 0 comments · Fixed by #19225
Closed

TypeError when using macro in root BUILD file #19156

thejcannon opened this issue May 25, 2023 · 0 comments · Fixed by #19225
Assignees
Labels

Comments

@thejcannon
Copy link
Member

Describe the bug
Given BUILD.pants:

docker_environment(
  name="focal-docker",
  image=wo_get_pinned_name("ubuntu:focal")
)

and macro:

def wo_get_pinned_name(x):
    return x

Pants version
2.16.0rc2

OS
Linux

Additional info

Exception caught: (pants.engine.internals.scheduler.ExecutionError)
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/bin/pants", line 8, in <module>
    sys.exit(main())
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 123, in main
    PantsLoader.main()
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 110, in main
    cls.run_default_entrypoint()
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 92, in run_default_entrypoint
    exit_code = runner.run(start_time)
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/bin/pants_runner.py", line 99, in run
    runner = LocalPantsRunner.create(
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 90, in create
    build_config = options_initializer.build_config(options_bootstrapper, env)
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/init/options_initializer.py", line 111, in build_config
    return _initialize_build_configuration(self._plugin_resolver, options_bootstrapper, env)
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/init/options_initializer.py", line 48, in _initialize_build_configuration
    working_set = plugin_resolver.resolve(options_bootstrapper, env)
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/init/plugin_resolver.py", line 137, in resolve
    for resolved_plugin_location in self._resolve_plugins(
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/init/plugin_resolver.py", line 161, in _resolve_plugins
    params = Params(request, determine_bootstrap_environment(session))
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/core/util_rules/environments.py", line 443, in determine_bootstrap_environment
    session.product_request(ChosenLocalEnvironmentName, [Params()])[0],
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 569, in product_request
    return self.execute(request)
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 513, in execute
    self._raise_on_error([t for _, t in throws])
  File "/home/josh/.cache/nce/ae553d873185fa750061b1a3d4226442fb99fb55d4403b0227ec972406554da3/bindings/venvs/2.16.0rc2/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 497, in _raise_on_error
    raise ExecutionError(

Exception message: 1 Exception encountered:

MappingError: Failed to parse ./BUILD.pants:
TypeError: _unrecognized_symbol_func() takes 0 positional arguments but 1 was given
@thejcannon thejcannon added the bug label May 25, 2023
@kaos kaos self-assigned this Jun 1, 2023
kaos added a commit that referenced this issue Jul 8, 2023
…p. (#19225)

Fixes #19156 

Not sure how to provide better error context here though. In the case
presented in the issue, the error could be slightly confusing as it is
reported as unrecognized when in fact it is defined as a macro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants