stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

Running `clarity-cli eval` hangs on invalid arguments instead of failing

Open BowTiedRadone opened this issue 3 months ago • 2 comments

When running clarity-cli eval with invalid arguments, the command hangs instead of returning an error:

$ clarity-cli eval --help
Usage: ./target/release/clarity-cli eval [--costs] [contract-identifier] (program.clar) [vm-state.db]

$ clarity-cli eval SP123 1.clar
# hangs forever

This happens because the binary tries to open a database using the contract identifier. The expected behavior is that the CLI should only try to open a VM state DB if one is provided. Otherwise, it should fail with an error.

BowTiedRadone avatar Sep 16 '25 15:09 BowTiedRadone

It turns out it's not really hanging, it's waiting for you to send something to standard input. This isn't really obvious though.

This is addressed in #6738. See the PR description for details. With that change, your call with invalid arguments will indeed fail with an error (because it tries to open 1.clar as a a DB).

benjamin-stacks avatar Dec 05 '25 08:12 benjamin-stacks

Thanks @benjamin-stacks! 🙏

BowTiedRadone avatar Dec 05 '25 10:12 BowTiedRadone