pants icon indicating copy to clipboard operation
pants copied to clipboard

error: KeyError: 'Version'

Open ethanquix opened this issue 1 year ago • 7 comments

Describe the bug When running pants tailor :: I have this error message:

❯ pants tailor ::
14:39:18.16 [INFO] Initialization options changed: reinitializing scheduler...
14:39:24.10 [INFO] Scheduler initialized.
14:39:28.41 [ERROR] 1 Exception encountered:

Engine traceback:
  in `tailor` goal

KeyError: 'Version'

Pants version 2.16.0

OS MacOS

Additional info Here is my pants.toml:

[GLOBAL]
pants_version = "2.16.0"

backend_packages = [
    "pants.backend.experimental.go",
    "pants.backend.python",
]

[golang]
minimum_expected_version = "1.20"

The first pants tailor :: works, but if I run it again I have this issue.

It happens also when I run other commands like:

❯ pants list ::
14:55:53.45 [ERROR] 1 Exception encountered:

Engine traceback:
  in `list` goal
  in Find targets from input specs

KeyError: 'Version'

ethanquix avatar Jul 14 '23 18:07 ethanquix

Welcome to the Pantsbuild Community. This looks like your first issue here. Thanks for taking the time to write it.

If you haven't already, feel free to come say hi on Slack.

If you have questions, or just want to surface this issue, check out the #development channel. (If you want to check it out without logging in, check out our Linen mirror)

Thanks again, and we look forward to your next Issue/PR :smile:!

WorkerPants avatar Jul 14 '23 18:07 WorkerPants

Thanks for the bug report! Would you be able to post (a simplified and redacted) version of the repo that reproduces this?

benjyw avatar Jul 14 '23 21:07 benjyw

And also, can you run with --print-stacktrace so we can get a full stacktrace for that error?

benjyw avatar Jul 14 '23 21:07 benjyw

This is something I experience myself in a repo that has in a go.mod file

replace company.org/packageA => ../common/packageA

replace company.org/packageB => ../common/packageB

require (
	company.org/packageA v1.2.3
	company.org/packageB v1.2.3
        ...
)

Removing those sections let Pants proceed.

@ethanquix are you able to interact with our https://github.com/pantsbuild/example-golang repository?

AlexTereshenkov avatar Jul 23 '23 07:07 AlexTereshenkov

I'm running into the same issue in my repo using pants. Using replace is added to use the proto code generated by pants (under dist/) and there's no way around this unfortunately. @benjyw, let me know if I can help debug the issue with logs, etc.

wslulciuc avatar Jan 09 '24 00:01 wslulciuc

Hi @wslulciuc , as mentioned earlier, the best way to facilitate debugging is to create a small public repo on github that recreates the issue.

benjyw avatar Jan 09 '24 03:01 benjyw

@ethanquix Is your project making use of the replace directive in a go.mod file? If so, it looks like this would be an instance of https://github.com/pantsbuild/pants/issues/14996

andrelegault avatar Apr 30 '24 17:04 andrelegault