Hardhat "HH8: There is one or more errors in your config file" in CI
Hardhat tried to evaluate hardhat.config.js or hardhat.config.ts and it either threw at import time or exported a shape that failed validation. Hardhat reports HH8 with the underlying error.
What this error means
Any hardhat command fails immediately with "HardhatError: HH8: There is one or more errors in your config file:" followed by the specific problem, before any compile or test runs.
HardhatError: HH8: There is one or more errors in your config file:
* Invalid value undefined for HardhatConfig.networks.sepolia.url - Expected a value of type string.Common causes
A config field reads an unset environment variable
A network URL or account key comes from process.env, which is empty in CI, so the config validates as undefined where a string is required.
The config file throws at import time
A required plugin is missing or a top-level statement throws, so the module never exports a valid config object.
How to fix it
Provide the missing config values in CI
- Read which field HH8 names as invalid.
- Set the corresponding secret or environment variable in the job.
- Guard optional networks so a missing key does not invalidate the whole config.
env:
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}Ensure required plugins are installed
A config that requires a plugin fails to import if the plugin is not in node_modules. Install it before running hardhat.
npm ciHow to prevent it
- Inject network URLs and keys through CI secrets, not committed defaults.
- Validate the config locally with
npx hardhatbefore pushing. - Keep plugin dependencies in
package.jsonsonpm ciinstalls them.