Terminal says I don't have enough cycles, but I do. Help?

Hi there, I’m very new to the Motoko language and the ICP. I recently deployed a new project to production. After doing so, I confirmed I have enough cycles to call a certain function by running dfx wallet --network ic balance in my terminal, which returned more than 5.2 Trillion cycles. But I’m getting an error, saying that I don’t have enough cycles, although I do not understand why.

The function was called in the terminal like this: dfx canister --network ic call opend mint '(vec {*many Nat8 Numbers*}, "Text input")' but was returned an error,
Error: The Replica returned an error: code 4, message: "Canister installation failed with Canister afixf-dyaaa-aaaaj-adamq-cai is out of cycles: requested 80000590000 cycles but the available balance is 500,000,000 cycles and the freezing threshold 0 cycles"`

If I have more than 5.2 Trillion cycles in my network ic wallet, why does my terminal say that I only have exactly 500 million? Do I need to transfer my cycles from my wallet to this canister? If so, how would I, because each time I run this command, it creates a new Canister with a different ID.

This function call was working seamlessly in developing mode (non-production), but now that we’re in production, I’m running into these cycles issues.

Hope to hear from someone soon,
Thanks :slight_smile:

1 Like

Are you using a canister to create an other canister ?
If so, does this creator canister has enough cycles ? Your problem might be related to a canister trying to execute a call too costly for its cycle balance because it does not use your wallet.
You can try to figure which canister is responsible for the call and top it up.


Hey @dymayday, thanks for your quick reply. Yes, you’re right, I am using a creator canister to create another canister.

TLDR: I’m a little stuck on how to add / top up cycles to this creator canister, even though I have enough cycles in my wallet. Do you know how I can top up successfully?

What I tried:
I know that the canister ID i’m using as the creator canister is btdpo-wiaaa-aaaaj-adajq-cai, as shown when running dfx deploy --network ic.

I tried as you suggested, trying to top up this canister. 1) using my cycles wallet https://walletprincipal/ID.ic0.app/ and 2) also the terminal. After clicking the button send cycles, my transaction history on this website shows that I transferred the cycles to canister ID. However, when running the command in my terminal, dfx wallet --network ic balance, I still get the same amount, as if I didn’t transfer any cycles to this creator canister.

So I proceeded to try to transfer cycles using the terminal, using dfx wallet --network ic send btdpo-wiaaa-aaaaj-adajq-cai 2000000, but got an error Error: Sending cycles to btdpo-wiaaa-aaaaj-adajq-cai failed with: Cycles sent: 2000000 An error happened during the call: 3: IC0302: Canister btdpo-wiaaa-aaaaj-adajq-cai has no update method 'wallet_receive'. Per another thread, I also tried dfx canister --network ic deposit-cycles <cycles> [canister] , but received the error: Error: The deposit cycles call needs to proxied via the wallet canister. Invoke this command without the –no-wallet flag. (which even though I never added, said it was there. I also tried adding --wallet, but that didn’t work).

In the end, I tried re-running the function call originally mentioned in the first post, but I’m still getting the same error with not having enough balance in the canister. I’m a little stuck on how to add / top up cycles to this creator canister, even though I have enough cycles in my wallet.

Hope to hear back soon,

Can you try to use your ledger instead ? I top-up my canisters with this command :

dfx ledger --network=ic top-up btdpo-wiaaa-aaaaj-adajq-cai --amount 0.01

Check the balance before and after with :

dfx canister --network=ic status btdpo-wiaaa-aaaaj-adajq-cai

(Please note that this is your provided address as an example)


Hey, thanks for your reply. I checked the balance of my creator canister using your second command, and I got 5.9 T cycles. I believe it was around 4T Cycles originally, but I sent 2T cycles via the Network Nervous System. My other canisters for this project show 3T and 3.9 T cycles.

Even so, I tried rerunning the function call in the original post, and I’m still getting "Canister installation failed with Canister uiwy6-jiaaa-aaaaj-add3q-cai is out of cycles: requested 80,000,590,000 cycles but the available balance is 500,000,000 cycles and the freezing threshold 0 cycles"

But this canister ID “uiwy6-jiaaa-aaaaj-add3q-cai” is a new dynamic Canister ID, so how can it have cycles? My creator canister has 5.9 T cycles, so is the issue that it’s not transferring the cycles properly to the new dynamic canister ID? This was working in development mode, though. I’m also not sure where this balance of 500 million cycles is coming from.

How do I add to my ledger? When I check my dfx ledger --network ic balance, I get 0 ICP, but on my NNS, I have some ICP, and I also have about 1.2 T cycles when trying dfx wallet --network ic balance.

Thanks so much

1 Like

I’m currently facing this issue. I have enough cycles but this is happening to me

Failed to install wasm module to canister 'frontend'.