I'm having issues when using the ReportTransactStatus in my XCM message as it gives me a UnexpectedResponse in my origin Parachain.

How can I register the matching query in the origin, so when the destiny responds I get a more descriptive message?

This is my XCM message code:

            match send_xcm::<T::XcmSender>(
                (Parent, Junction::Parachain(mult_para_id.into())).into(),
                    Transact {
                        origin_kind: OriginKind::Native,
                        require_weight_at_most: Weight::from_parts(1_000, 1_000),
                        call: <T as Config>::RuntimeCall::from(Call::<T>::xcm_clone_file {
                            energy_bank_file: new_file
                    ReportTransactStatus(QueryResponseInfo {
                        destination: MultiLocation {parents: 1, interior: Parachain(2000).into()},
                        max_weight: Weight::from_all(0),
            ) {
                Ok((hash, cost)) => Self::deposit_event(Event::Success(mult_para_id)),
                Err(e) => Self::deposit_event(Event::Error(e, mult_para_id)),

I've also tried using SetErrorHandler w/ ExpectTransactStatus as well, but I got the same results.

SetErrorHandler(Xcm(vec![ReportTransactStatus(QueryResponseInfo {
            destination: MultiLocation {parents: 1, interior: Parachain(2000).into()},
            max_weight: Weight::from_all(0),
// Transact here,

The UnexpectedResponse error: enter image description here

Deeply appreciate any help or documentation/examples to look further. Thank you

I've setup the ResponseHandler for the pallet and tight coupled with the pallet_xcm so I can create new queries.

But I'm now having problems when trying to call the new_notify_query function, because the RuntimeCall I'm passing as parameter is the wrong type.

Here is how I'm creating the RuntimeCall and how I'm calling the new_notify_query function.

let call = Call::<T>::report { query_id: 0, outcome: Default::default() };

let query_id = pallet_xcm::Pallet::<T>::new_notify_query(
    MultiLocation {parents: 1, interior: Parachain(2000).into()},
    <T as pallet::Config>::RuntimeCall::from(call),
// The report dispatchable
#[pallet::weight((0, Pays::No))]
pub fn report(origin: OriginFor<T>, query_id: QueryId, outcome: Response) -> DispatchResult { 
    // let responder = ensure_response(<T as Config>::RuntimeOrigin::from(origin))?;
    Self::deposit_event(Event::Report(query_id, outcome));

And the pallet Config

    pub trait Config: frame_system::Config + pallet_xcm::Config {
        /// The overarching event type.
        type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

        type RuntimeOrigin: From<<Self as SystemConfig>::RuntimeOrigin>
        + Into<Result<CumulusOrigin, <Self as Config>::RuntimeOrigin>>;

        /// The overarching call type; we assume sibling chains use the same type.
        type RuntimeCall: IsType<<Self as Config>::RuntimeCall> + From<Call<Self>> + Encode;

        type XcmSender: SendXcm;
        type ResponseHandler: OnResponse;
        // type PolkadotXcm: PolkadotXcm;
        type EnergyBank: EnergyBank<Self::AccountId>;

The error: enter image description here

1 Answer 1


Do you have your own response handler? Check this: https://github.com/paritytech/polkadot-sdk/blob/v1.4.0/polkadot/xcm/pallet-xcm/src/lib.rs#L2459, it was the default implementation.

So first, you should insert query_id into polkadot-xcm::Queries storage. Maybe using pallet-xcm::new_notify_query which calls do_new_query and insert the queryId into the Queries storage.

Then, implement your response handler and config it

in xcm_executor::Config => type ResponseHandler = <Yours>

  • How can I insert the query_id into polkadot-xcm::Queries? I can't do it via extrinsics. And about implementing my response handler, I need to implement the OnResponse trait in my XCM pallet? Then export it to my xcm_config.rs? Can you give me an example of a pallet using the ResponseHandler implementation? Thanks again for the help :) Nov 27, 2023 at 18:43
  • Updating.. I've added the ResponseHandler to my pallet config, and in the runtime I used the polkadotXcm, like this: type ResponseHandler = PolkadotXcm I think now I only need to register the query_idin the polkadot-xcm::Queries storage. How could I do that? Nov 27, 2023 at 20:05
  • 1
    There is a public function new_notify_query in pallet-xcm, which calls do_new_query and insert the queryId into Queries storage, you can try using it.
    – Guantong
    Nov 28, 2023 at 1:47
  • Thank you a lot for the help, I did a tight coupling to be able to call the function but I'm having issues with the notify parameter. I can't properly create the runtime call without getting a trait not implemented error. I've researched a lot in the repo u sent but only found references of use in a mocked environment. I will update the question and would appreciate further help, thanks :))) Nov 28, 2023 at 18:49
  • Make sure your fn report was a call, in #[pallet:call] imp<T:Config> Pallet<T>{} like here. I can't identify other errors.
    – Guantong
    Nov 29, 2023 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.