Error: please top up the canister with at least 28_585_618_602 additional cycles

After calling dfx deploy frontend --network ic I got

Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to install all canisters.
Caused by: Failed to install wasm module to canister 'frontend'.
Caused by: Failed to store assets in canister 'frontend'.
Caused by: Failed asset sync with canister lwdq3-vqaaa-aaaal-acwda-cai.
Caused by: Failed to create batch: The replica returned a rejection error: reject code SysTransient, reject message Canister lwdq3-vqaaa-aaaal-acwda-cai is out of cycles: please top up the canister with at least 28_585_618_602 additional cycles, error code None

However, I used to deploy with about 12 TC, then I made few changes to get such a strange error. I don’t know which caused the canister to requires more cycles like that

  1. Could it be having more canister like cketh_ledger, ckusdc_ledger, but I am not actually deploying them I am just using their declarations
  2. ?

First, cycle count 28_585_618_602 represents the total cost for the freezing threshold and requested action.

To better understand the cost of the canister deployment, subtract the freezing threshold from the total cycle count. It’s a bit hard to say exactly why deployment increased in cost but here are a few things to check on:

  1. What is your current freezing threshold? Have you increased it from the default of 2,590,000 cycles?

You can verify this information using the following command:

dfx canister status <canister_name> --network=ic

  1. Did you switch to a different subnet? The canister will be replicated across all of the replicas in the subnet so if you moved to a subnet with more replicas, that could explain the increase.

  2. What are the type of changes that you made?

  1. How Can I check the subnet thing ?

  2. also runing dfx wallet --network ic balance I got 27.675 TC (trillion cycles).
Canister status call result for frontend.
Status: Running
Controllers: 2nvlk-tyaaa-aaaal-ab5ya-cai ggj4v-72tnz-rd673-mjjid-ljvyu-gdwyo-c2x7t-szji2-pfmoo-bhv7p-pae
Memory allocation: 0
Compute allocation: 0
Freezing threshold: 2_592_000
Memory Size: Nat(93794999)
Balance: 39_957_390_290 Cycles
Reserved: 0 Cycles
Reserved cycles limit: 5_000_000_000_000 Cycles
Wasm memory limit: 3_221_225_472 Bytes
Module hash: 0x3a533f511b3960b4186e76cf9abfbd8222a2c507456a66ec55671204ee70cae3
Number of queries: 34_853
Instructions spent in queries: 41_393_238_900
Total query request payload size (bytes): 5_013_125
Total query response payload size (bytes): 394_901_507
Log visibility: controllers

I also tried dfx canister update-settings frontend --freezing-threshold 3472000 but it did not work

also this is my dfx file

{
  "declarations": {
    "output": "src/declarations",
    "capabilities": ["nodejs"]
  },
  "canisters": {
    "internet_identity": {
      "candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
      "remote": {
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      },
      "type": "custom",
      "wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm.gz"
    },
    "cketh_ledger": {
      "type": "custom",
      "candid": "https://raw.githubusercontent.com/dfinity/ic/3d0b3f10417fc6708e8b5d844a0bac5e86f3e17d/rs/rosetta-api/icrc1/ledger/ledger.did",
      "wasm": "https://download.dfinity.systems/ic/3d0b3f10417fc6708e8b5d844a0bac5e86f3e17d/canisters/ic-icrc1-ledger.wasm.gz",
      "remote": {
        "id": {
          "ic": "ss2fx-dyaaa-aaaar-qacoq-cai"
        }
      }
    },
    "ckusdc_ledger": {
      "type": "custom",
      "candid": "https://raw.githubusercontent.com/dfinity/ic/3d0b3f10417fc6708e8b5d844a0bac5e86f3e17d/rs/rosetta-api/icrc1/ledger/ledger.did",
      "wasm": "https://download.dfinity.systems/ic/3d0b3f10417fc6708e8b5d844a0bac5e86f3e17d/canisters/ic-icrc1-ledger.wasm.gz",
      "remote": {
        "id": {
          "ic": "xevnm-gaaaa-aaaar-qafnq-cai"
        }
      }
    },
    "internet_identity": {
      "candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
      "remote": {
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      },
      "type": "custom",
      "wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm.gz"
    },
    "backend": {
      "candid": "src/backend/backend.did",
      "package": "backend",
      "type": "rust"
    },
    "frontend": {
      "dependencies": ["backend"],
      "frontend": {
        "entrypoint": "src/frontend/index.html"
      },
      "source": ["build", "src/frontend"],
      "type": "assets"
    }
  },
  "output_env_file": ".env",
  "defaults": {
    "build": {
      "output": "canisters",
      "packtool": ""
    }
  },
  "version": 1,
  "dfx": "0.24.0"
}

I also tried

 dfx wallet send lwdq3-vqaaa-aaaal-acwda-cai 2000000000
Error: Failed to setup wallet caller.
Caused by: An error happened during communication with the replica: error sending request for url (http://0.0.0.0:8080/api/v2/status)
Caused by: error sending request for url (http://0.0.0.0:8080/api/v2/status)
Caused by: client error (Connect)
Caused by: tcp connect error: Connection refused (os error 61)
Caused by: Connection refused (os error 61)

regarding the commands: always make sure to add --ic or --network=ic, otherwise dfx tries to execute the command on the local replica instead of IC mainnet.

2 Likes

Yes, like @marc0olo mentioned. Please make sure that you are running the commands on mainnet.

The freezing threshold that you have is the default one so you didn’t change it to something significant that it would result is more cycles being burned.

What changes did you make to your code?

1 Like