hardhat
hardhat copied to clipboard
Artifact not found error right after compilation
Nico from balancer shared this error with me
$ hh compile --show-stack-traces
Nothing to compile
Error HH700: Artifact for contract "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/EnumerableSet.sol:EnumerableSet" not found.
HardhatError: HH700: Artifact for contract "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/EnumerableSet.sol:EnumerableSet" not found.
at Artifacts._handleWrongArtifactForFullyQualifiedName (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/artifacts.ts:457:11)
at Artifacts._getValidArtifactPathFromFullyQualifiedNameSync (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/artifacts.ts:566:19)
at Artifacts._getArtifactPathSync (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/artifacts.ts:322:19)
at Artifacts.removeObsoleteArtifacts (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/artifacts.ts:188:16)
at SimpleTaskDefinition.action (/home/nventuro/bal/v2/node_modules/hardhat/src/builtin-tasks/compile.ts:1377:23)
at Environment._runTaskDefinition (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:35)
at Environment.run (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:25)
at SimpleTaskDefinition.action (/home/nventuro/bal/v2/node_modules/hardhat/src/builtin-tasks/compile.ts:1407:11)
at Environment._runTaskDefinition (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/home/nventuro/bal/v2/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
He's getting an HH700 despite nothing being done.
I suspect this is a bug in our build-info clearing logic.
Will update with the list of plugins he is using.
This issue is also being tracked on Linear.
We use Linear to manage our development process, but we keep the conversations on Github.
LINEAR-ID: fb369d0b-2187-4ae9-958a-fae624383ce8
Plugins:
"@nomiclabs/hardhat-ethers@npm:^2.0.1":
version: 2.0.2
"@nomiclabs/hardhat-etherscan@npm:latest":
version: 2.1.6
My friend, i meet the same problem
In the end, I found out that it was because hardhat could not find the contract, so I needed to specify the contract path for it.
Just modify the path in hardhat.config.ts, more information can be found here: https://hardhat.org/config/
Hope to help you

Thanks, @hedgezhu!
I'm not sure if that can be a solution, as that's the default behavior of Hardhat.
That's ok. Let's figure out how to fix this bug
This is still not working even with paths specified. Arghhh this is so frustrating. What am I missing ? https://github.com/ihorbond/hardhat-test
@ihorbond did you figure that out? The repo you linked doesn't exist anymore.
@fvictorio yes there was a separate issue with Windows and glob package that I opened and you already fixed :)
Glad to hear that!
This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
i meet the same problem, it works after clear cache:
rm -rf cache
rm -rf artifacts
@ysqi you can use npx hardhat clean
to do that.
I tried doing npx hardhat clean
and specifying the paths still not working. has anyone else figured it out yet?
@codantes can you please open a new issue. This one is about an innocuous error that only happens very infrequently, and I suspect yours is a different one.
I'm getting this problem in Github Actions specifically, so far haven't been able to consistently reproduce it locally. Even in Github Actions it happens something like half of the time. Really frustrating! Tried running clean (removing artifacts etc.) before hardhat compile
, but right after hardhat compile
sometimes the artifacts
directory just doesn't contain the JSONs that other scripts expect.
For me, it helped to downgrade Node.js from 18.16.0
to 18.12.1
. I hope I can use the latest Node once this is fixed :)
@mildlycoder have you figured it out?
If this happens during the removeObsoleteArtifacts
phase, it means the artifact in the cache
folder exists, but doesn't exist in artifacts
. This is somewhat a rare case, as two conditions must be matched:
- the
artifacts
folder was removed manually or in some clean-up process, but thecache
folder wasn't. - some changes to the codebase must be made to remove some Contract dependency so that it is not emitted to the artifacts folder.
So after the compilation, Hardhat
tries to clean the obsolete artifacts, that it finds in cache
folder, but throws the error as it is not found in artifacts
.
The workaround: make sure the cache
folder is removed during the cleanup
Desired Hardhat fix: if the artifact can't be found in removeObsoleteArtifacts
method, it should be silently skipped, as it was already successfully removed previously.
in my case it was that the artifact file name was correct but the contract name didn't match the file name
@ysqi you are my hero :)