I'm working on a custom plugin and I did this: ```...
# plugins
d
I'm working on a custom plugin and I did this:
Copy code
content = FileContent(path=versions_file_path, content="some string")
digest = await Get(Digest, CreateDigest([content]))
That resulted in the infamous
Filesystem changed during run: retrying 'MyGoal'
infinite loop. I was really confused. Upon further inspection of the run logs, I found this:
Copy code
09:14:56.95 [31m[ERROR][0m panic at 'called `Result::unwrap()` on an `Err` value: "Field `content` was not convertible to type alloc::vec::Vec<u8>: PyErr { type: <class 'TypeError'>, value: TypeError(\"'str' object cannot be interpreted as an integer\"), traceback: None }"', src/intrinsics.rs:422
So I updated the code above to call
.encode()
on the string before passing it as
content
and things started working. However, I feel like my mistake should have resulted in an error / failure instead of the infinite
Filesystem changed
loop. Should I open a bug for this?
c
Hi, yes please do open an issue for this. That mistake is easy enough to make, and could be caught and reported with a clear message what was wrong.
a type checker would tell you
content
is of type
bytes
, but it’s not likely you’ll reach for one when you hit an issue like this. https://github.com/pantsbuild/pants/blob/main/src/python/pants/engine/fs.py#L53
d
Okay, I opened an issue here.
c
Thanks, and sorry for the trouble.
d
No need to apologize! As I mentioned in the ticket:
Copy code
Additional info
I like pants
❤️ 2
😅 2