<#20859 Cryptic error when `package.json` is missi...
# github-notifications
c
#20859 Cryptic error when `package.json` is missing a name Issue created by yjabri Is your feature request related to a problem? Please describe. I was trying out the experimental JavaScript backend and running some "unfriendly" behavior. I've included a minimal reproduction repo to try the following in. Run
pants tailor ::
. It populates
foo/BUILD
with
Copy code
package_json()
Run
pants tailor ::
again. You'll get
Copy code
$ pants tailor ::
14:56:17.68 [ERROR] 1 Exception encountered:

Engine traceback:
  in `tailor` goal

KeyError: 'name'
In a non minimal repo I had
package_json()
populate like
package_json(name="foo0")
since I had a python distribution with the same name. Given
KeyError: 'name'
it feels like
tailor
is writing an invalid target to the BUILD file. Also running
pants help targets package_json
doesn't enumerate a
name
field. It took me some time to realize this had nothing to do with the BUILD file but instead that my
package.json
was missing a name. Describe the solution you'd like A more explicit message should be given to the caller that
package.json
needs to have a name the first time
pants tailor
(or any goal that consumes the file) is called. Describe alternatives you've considered Additional context pantsbuild/pants