Internet Computer

Why does a call from my engine canister fail when it works on other subnets?

All help topics

Cloud engines run on a CloudEngine subnet with a free cost schedule, and the protocol enforces call rules there that ordinary subnets don't have.

1. Never attach cycles

Engine canisters hold 0 cycles, so a call carrying any non-zero amount fails with Canister CANISTER_ID is out of cycles, error code Some("IC0504"). Remove the clause entirely: no (with cycles = …) in Motoko, no .with_cycles(…) in Rust. Don't set it to zero instead, and never attach a fee you computed or copied from a cost table.

2. Calls across the engine's boundary must be bounded-wait

A plain (unbounded-wait) call to a canister on another subnet is rejected with Unbounded-wait calls and calls with cycles are not allowed to CloudEngine subnets. Give it a timeout:

  • Motoko: await (with timeout = 30) service.method(args) (seconds)
  • Rust: Call::bounded_wait(canister_id, "method").with_arg(arg).await

The rule applies both ways: a canister elsewhere calling into your engine must use a bounded-wait, cycle-free call too. Calls between canisters on the same engine are exempt, though bounded-wait is still the safer default. A bounded-wait call can come back as SYS_UNKNOWN (outcome unknown), so handle that.

3. HTTPS outcalls: ordinary code, free

Keep the standard wrapper (Call.httpRequest in Motoko, the HttpRequest builder in Rust). It asks the system what the outcall costs, gets 0 on an engine and attaches nothing. Make outcalls from your own canister, never through a proxy.

4. Paid services on other subnets go through the proxy

Threshold ECDSA and Schnorr signing, vetKD, the exchange-rate canister, the Bitcoin API and the EVM and SOL RPC canisters charge cycles and live outside your engine, which holds no threshold keys. Call them through the engine's proxy canister. Helper libraries that call them directly (ic-vetkeys, the chain-key functions of ic-cdk-management-canister, Motoko's mo:ic-vetkeys/ManagementCanister) attach cycles themselves and fail on an engine: encode the arguments yourself and send them through the proxy.

Tell your coding agent

Have it load the cloud-engine-canisters skill before it writes or debugs engine code: it carries these rules, the proxy interface and the common errors.

Learn more
Still stuck? Contact support