1

I cannot get my head around this, I cannot replicate it, it's driving me nuts.

About 1% of orders encounter this error. It was even worse before, but now I've changed the default behaviour of sending the order confirmation emails and it's better, but the error still persists.

I've placed a logger on the sales_model_service_quote_submit_failure event, and this is what I've found so far:

The error (& trace):

Invalid state change requested Error trace: #0 /public_html/vendor/magento/framework/Interception/Interceptor.php(121): Magento\Quote\Model\QuoteRepository\Plugin\AccessChangeQuoteControl->beforeSave(Object(Magento\Quote\Model\QuoteRepository\Interceptor), Object(Magento\Quote\Model\Quote\Interceptor)) #1 /public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\QuoteRepository\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Quote\Model\Quote\Interceptor)) #2 /public_html/generated/code/Magento/Quote/Model/QuoteRepository/Interceptor.php(78): Magento\Quote\Model\QuoteRepository\Interceptor->___callPlugins('save', Array, Array) #3 /public_html/vendor/magento/module-quote/Model/QuoteManagement.php(522): Magento\Quote\Model\QuoteRepository\Interceptor->save(Object(Magento\Quote\Model\Quote\Interceptor)) #4 /public_html/vendor/magento/module-quote/Model/QuoteManagement.php(406): Magento\Quote\Model\QuoteManagement->submitQuote(Object(Magento\Quote\Model\Quote\Interceptor), Array) #5 /public_html/vendor/magento/module-quote/Model/QuoteManagement.php(364): Magento\Quote\Model\QuoteManagement->submit(Object(Magento\Quote\Model\Quote\Interceptor)) #6 /public_html/vendor/magento/module-quote/Model/GuestCart/GuestCartManagement.php(87): Magento\Quote\Model\QuoteManagement->placeOrder('12072', NULL) #7 /public_html/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php(106): Magento\Quote\Model\GuestCart\GuestCartManagement->placeOrder('6cO0iqVSBtALdCO...') #8 /public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Model\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('6cO0iqVSBtALdCO...', 'gilea_irina@yah...', Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address)) #9 /public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->___callParent('savePaymentInfo...', Array) #10 /public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->Magento\Framework\Interception\{closure}('6cO0iqVSBtALdCO...', 'gilea_irina@yah...', Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address)) #11 /public_html/generated/code/Magento/Checkout/Model/GuestPaymentInformationManagement/Interceptor.php(26): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->___callPlugins('savePaymentInfo...', Array, Array) #12 [internal function]: Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->savePaymentInformationAndPlaceOrder('6cO0iqVSBtALdCO...', 'gilea_irina@yah...', Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address)) #13 /public_html/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array) #14 /public_html/vendor/magento/module-webapi/Controller/Rest.php(244): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy)) #15 /public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http)) #16 /public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array) #17 /public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #18 /public_html/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array) #19 /public_html/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #20 /public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch() #21 /public_html/vendor/magento/framework/App/Bootstrap.php(257): Magento\Framework\App\Http\Interceptor->launch() #22 /public_html/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #23 {main}

And more, during that event: - customer is not seen as a guest (customer_is_guest on order model & quote model returns 0) - customer ID exists on both quote & order model. Sometimes, customer ID matches an account that has the same email. Sometimes, it's a very close match (maybe the same customer that has a customer account using other email address?) - all orders end up, eventually, created with customer_is_guest = 1;

I suspect a session problem, seems the most likely scenario. I'm using cart persistency as well, guest orders are enabled, multishipping is not. Magento 2.2.6 on litespeed (no litemage) & redis for file & session storage (the problem occurs without redis as well).

Please don't tell me to look where the error is thrown, already mentioned I can't replicate it.

2

1 Answer 1

0

The error should be coming from this file: paradoxlabs/authnetcim/Observer/CheckoutFailureClearAcceptjsObserver.php $this->quoteRepository->save($payment->getQuote()); is throwing the invalid state error. After the error has been threw, the customer can resend the request which creates an invalid order. The reason of the error is not replicable for now.

You can fix this by adding an error check before customer placing an order, so they won't be able to checkout with an invalid quote. Add a plugin to add a check "! $this->changeQuoteControl->isAllowed($quote)" class QuoteManagement beforePlaceOrder to make sure the quote is valid.

Here is a link from Magento github who also has the same issue: https://github.com/magento/magento2/issues/9051 You can see this is related to ParadoxLabs

If you want to debug this issue, you will need to patch Magento with this patch: https://github.com/magento/magento2/pull/22037

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.