Skip to content

HHE100: An internal invariant was violated: Invariant violated: neither timeouts or failures #7826

@zhangwei983

Description

@zhangwei983

Version of Hardhat

3.1.0

What happened?

I'm using await connection.ignition.deploy() to deploy a buildModule, but got below error

HardhatError: HHE100: An internal invariant was violated: Invariant violated: neither timeouts or failures
    at _toText (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition/src/helpers/error-deployment-result-to-exception-message.ts:138:9)
    at _convertExecutionError (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition/src/helpers/error-deployment-result-to-exception-message.ts:96:58)
    at errorDeploymentResultToExceptionMessage (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition/src/helpers/error-deployment-result-to-exception-message.ts:31:14)
    at ViemIgnitionHelperImpl.deploy (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition-viem/dist/src/internal/viem-ignition-helper.js:95:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async main (/home/vincent/repos/nft-contract/scripts/deploy.ts:16:26)

Minimal reproduction steps

This is my deploy.ts script

import hre from "hardhat";
import { USDT_CONFIG } from "./config.js";
import MockERC20Module from "../ignition/modules/MockERC20.js";

async function main() {
  const connection = await hre.network.connect();

  let usdtAddress = undefined;

  if (connection.networkName === "sepolia") {
    usdtAddress = USDT_CONFIG.sepolia;
  } else if (
    connection.networkName === "localhost" ||
    connection.networkName === "default"
  ) {
    const { MockUSDT } = await connection.ignition.deploy(MockERC20Module, {
      displayUi: true,
    });
    usdtAddress = MockUSDT.address;
  } else {
    throw new Error(`Unsupported network: ${connection.networkName}`);
  }
}

main().catch(console.error);

This is the MockERC20 module

import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

export default buildModule("MockERC20Module", (m) => {
  const MockUSDT = m.contract("MockERC20", ["Mock USDT", "USDT"]);

  return { MockUSDT };
});

When running npx hardhat run scripts/deploy.ts --network localhost against the network started by npx hardhat node, I got

[ MockERC20Module ] failed ⛔


HardhatError: HHE100: An internal invariant was violated: Invariant violated: neither timeouts or failures
    at _toText (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition/src/helpers/error-deployment-result-to-exception-message.ts:138:9)
    at _convertExecutionError (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition/src/helpers/error-deployment-result-to-exception-message.ts:96:58)
    at errorDeploymentResultToExceptionMessage (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition/src/helpers/error-deployment-result-to-exception-message.ts:31:14)
    at ViemIgnitionHelperImpl.deploy (/home/vincent/repos/nft-contract/node_modules/@nomicfoundation/hardhat-ignition-viem/dist/src/internal/viem-ignition-helper.js:95:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async main (/home/vincent/repos/nft-contract/scripts/deploy.ts:16:26)

Search terms

HHE100

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-more-infoThere's not enough information to start working on this issue

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions