Skip to content
Latchkey

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.

Hardhat
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

  1. Read which field HH8 names as invalid.
  2. Set the corresponding secret or environment variable in the job.
  3. Guard optional networks so a missing key does not invalidate the whole config.
.github/workflows/ci.yml
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.

Terminal
npm ci

How to prevent it

  • Inject network URLs and keys through CI secrets, not committed defaults.
  • Validate the config locally with npx hardhat before pushing.
  • Keep plugin dependencies in package.json so npm ci installs them.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →