bored-art-40741
04/01/2021, 12:04 AM20:03:30.47 [ERROR] panic at 'called `Result::unwrap()` on an `Err` value: "Field `content` was not convertible to type alloc::vec::Vec<u8>: PyErr { ptype: <class \'TypeError\'>, pvalue: Some(\'an integer is required (got type str)\'), ptraceback: None }"', src/intrinsics.rs:354
20:03:30.47 [ERROR] Please set RUST_BACKTRACE=1, re-run, and then file a bug at <https://github.com/pantsbuild/pants/issues>.
20:03:30.47 [INFO] Filesystem changed during run: retrying `@rule(pants.backend.experimental.jvm.goals.coursier_resolve.coursier_generate_lockfile)` in 500ms...
RUST_BACKTRACE=1
already set)hundreds-father-404
04/01/2021, 12:05 AMps aux | grep pantsd
kill -9 <pid>
bored-art-40741
04/01/2021, 12:06 AM@rule(level=LogLevel.DEBUG)
async def digest_to_file_digest(request: ExtractFileDigest) -> FileDigest:
digest = await Get(Digest, DigestSubset(request.digest, PathGlobs([request.file_path])))
digest_contents = await Get(DigestContents, Digest, digest)
if len(digest_contents) == 0:
raise Exception(f"ExtractFileDigest: '{request.file_path}' not found in {request.digest}.")
elif len(digest_contents) > 1:
raise Exception(
f"ExtractFileDigest: Unexpected error: '{request.file_path}' found multiple times in {request.digest}"
)
file_content = digest_contents[0]
hasher = hashlib.sha256()
hasher.update(file_content.content)
return FileDigest(
fingerprint=hasher.hexdigest(), serialized_bytes_length=len(file_content.content)
)
hundreds-father-404
04/01/2021, 12:07 AMstr
instead of bytes
bored-art-40741
04/01/2021, 12:08 AMhundreds-father-404
04/01/2021, 12:08 AMCreateDigest -> Digest
, with a bad FileContent
entrybored-art-40741
04/01/2021, 12:09 AMhundreds-father-404
04/01/2021, 12:11 AMawait Get(Digest, CreateDigest)
somewhere? The Rust stacktrace is saying that the error is coming from the rule written in Rust ("an intrinsic rule") that goes from CreateDigest to Digest
Specifically, that rule implemented in Rust is failing because the CreateDigest
object has a FileContent
value in it that has a field content
set as unicode str, instead of bytes
. To fix your issue, you will need to find that bad FileContent
and encode the content
bored-art-40741
04/01/2021, 12:12 AMhundreds-father-404
04/01/2021, 12:15 AMdef __post_init__(self):
if isinstance(self.content, str):
raise ValueError(self)
This will cause Python to error on the problematic FileContent using Python's dataclass mechanism.bored-art-40741
04/01/2021, 12:15 AMjson.dumps
doesn't return bytes
hundreds-father-404
04/01/2021, 12:19 AM