IDL error: unexpected IDL type when parsing Nat

Hello. Help please with problem.

I created method at HotelPhotoNode actor.

public shared func getHotelPhotos(id: Nat32) : async (?[T.HotelPhoto]) {
        let filteredList = List.filter<T.HotelPhoto>(hotelPhotoList, func h { h.id_hotel == id });    
        switch (filteredList) {
            case (null) { return null; };
            case (?list) { 
                if (List.isNil<T.HotelPhoto>(?list)) {
                    return null;
                } else {
                    return ?List.toArray<T.HotelPhoto>(?list);
                }
            };
        };
    };

I trying to call it from another (main) actor.

public func getPhotoByHotel(id: Nat32) : async ?T.HotelPhoto {
        for ((hotel_id, canister_id) in Trie.iter(_hpids)) {  
            if (hotel_id == id) {                
                let hotelPhotoNode = actor (canister_id) : actor {
                    getHotelPhotos : shared ( Nat32 ) -> async (?[T.HotelPhoto]);
                };
                let hotelPhoto = await hotelPhotoNode.getHotelPhotos(id);
                switch(hotelPhoto)
                {
                    case(null)
                    {
                        return null;
                    };
                    case(?arr)
                    {
                        let answer = arr[0];
                        return ?answer; 
                    };
                };                
            }
        };
        return null;  
    };

When i call getPhotoByHotel i got reject error:


Error: Failed update call.
Caused by: The replica returned a rejection error: reject code CanisterReject, reject message IC0503: Error from Canister edess-pmaaa-aaaaa-qaa4q-cai: Canister called `ic0.trap` with message: IDL error: unexpected IDL type when parsing Nat
Canister Backtrace:
@deserialize_go<N>
@deserialize<N>
getHotelPhotos
.
Consider gracefully handling failures from this canister or altering the canister to handle exceptions. See documentation: http://internetcomputer.org/docs/current/references/execution-errors#trapped-explicitly, error code None

If i understood correctly its misstake with types (Nat and Nat32), but thet are (both methods) using Nat32. Please help :innocent:

To me, that suggests that getHotelPhoto is expecting a Nat, not a Nat32. Is it possible the canister is running some stale code that still expects a Nat (say from a previous version)?

What happens if you send a Nat instead?

If you have the canister ids available and they are installed on mainnet, you might be able to use the internet computer dashboard to find out what the interface of each canister is to check whether it is actually expecting a Nat or Nat32.

I solved it. I created node-canister before i make changes. So i cleaned up list of canisters and create new (with new code).