I just hit the instruction limit!

I just hit the instruction limit with dfx 0.20.1 and azle 0.20.1 (whoa, cool version coincidence).

This is a great example of the major blocker the instruction limit can be, as I am trying to use the motoko npm package, calling into its API. To overcome the limit as an end-user developer might be practically impossible, as it would require improvements to ICP, Azle, or the motoko npm package.

Here’s the code:

import { Server } from "azle";
import express from "express";

export default Server(() => {
  const mo = require("motoko");

  const app = express();

  app.post("/compile", (req, res) => {
          actor {
              public query func helloWorld(): async Text {
                  "Hello World!"

    const result = mo.wasm("/main.mo", "ic");


  return app.listen();

Calling the /compile endpoint gives in part: Replica Error: reject code CanisterError, reject message Error from Canister bkyz2-fmaaa-aaaaa-qaaaq-cai: Canister exceeded the instruction limit for single message execution.

When executing this during post_upgrade the instruction limit was not reached.

1 Like