As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [exception]

Denotes questions related to exceptions (An unusual condition during computation)

Filter by
Sorted by
Tagged with
66 votes
13 answers
103k views

'Area code not set' issue in custom CLI commands in Magento 2

I'm getting following error while updating data through CustomerRepositoryInterface [Magento\Framework\Exception\SessionException] Area code not set: Area code must be set before starting a ...
MJ.'s user avatar
  • 829
45 votes
2 answers
22k views

What's the preferred way of throwing exceptions in Magento?

All of the following methods are used in Magento core so which one is the preferred (or the latest "best practice") way? Mage::throwException('Some Message') - 732 Usages throw new Exception('Some ...
salmatron's user avatar
  • 553
23 votes
2 answers
43k views

Exception handling in Magento 2

In Magento 1 I was able to catch exceptions and log them into the exception.log file using Mage::logException($e); Now, in Magento 2, I can catch (\Exception $e) but what do I do with the caught ...
Andre Nickatina's user avatar
15 votes
3 answers
506 views

Dealing with neutered type hinting in Magento

Just wondering if anyone has better strategies than I've thought of for type checking to co-exist with Magento's custom error handler. Specifically, I'm wondering about a "Catchable Fatal Errors" as ...
mpw's user avatar
  • 1,050
14 votes
6 answers
7k views

How can I get email notifications for exceptions?

How do I setup email notifications for exceptions that are either logged or thrown on the site? UPDATE: A few people have commented on the fact that you may expect to get way too many emails if you ...
kalenjordan's user avatar
  • 3,535
13 votes
6 answers
12k views

Category error : Item (Magento\Catalog\Model\Category\Interceptor) with the same ID "191" already exists

I know there is a similar issue regarding a product, but now I've got this error with a category. I can't recall that I did something different, it just all of a sudden started throwing this error as ...
Giel Berkers's user avatar
  • 12.1k
13 votes
1 answer
296 views

Is there a good reason to put the same code in both try AND catch blocks?

In the file: app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php, within the render() method, it seems like the exact same code is being run in both the try and catch blocks. ...
David Angel's user avatar
9 votes
1 answer
6k views

Custom Exceptions for module for Magento 2

There are a few good-answered questions like this for Magento 1, but I haven't found anything for Magento 2. What should be the way for adding in custom module custom Exception class. Can I add some ...
Bartosz Kubicki's user avatar
8 votes
3 answers
11k views

Magento2.2 - - Failed to read session data

If you open the front end with multiple tabs in the browser, the following error is output:. Exception #0 (Exception): Warning: session_start(): Failed to read session data: user (path: /var/opt/remi/...
mr.hironobu's user avatar
8 votes
4 answers
9k views

Magento 2 : Event Observer Exception Not Showing in Screen

In custom extension, I create observer like this. app\code\Vendor\Extension\etc\frontend\events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Dhiren Vasoya's user avatar
8 votes
2 answers
27k views

Magento 2.0: Exception printing is disabled by default for security reasons

I was able to login into Admin and see the website albeit without any data or graphics. shortly I received this message: Exception printing is disabled by default for security reasons I don't ...
George Ng's user avatar
  • 101
7 votes
11 answers
66k views

Magento 2: Requested store is not found

I had two websites with different store and storeviews. I just deleted one website which is not the default one. After deleting it the admin panel page and also the front page shows this error ...
Zammuuz's user avatar
  • 410
7 votes
1 answer
2k views

Best practice for returning errors in WebApi

So let's say I have a model, responding to my webapi calls, whats the best way to return an error to the api consumer. For example, in the code below, the second line query the category factory (di-ed)...
Yehia A.Salam's user avatar
6 votes
2 answers
4k views

How to resolve Exception #0 (Exception): Notice: Array to string conversion Mailchimp Error

Exception #0 (Exception): Notice: Array to string conversion in /public_html/vendor/magento/framework/View/Element/Html/Select.php on line 244 line 235-244 of the Select.php public function ...
Mage Explorer's user avatar
6 votes
1 answer
2k views

Magento 2: Where Does the Error Handler Redirect to the Home Page

Date: May 27th, 2015 (given the fast changing nature of Magento 2) For many classes of PHP errors/exceptions in Magento 2, the default system behavior is to redirect the user to the homepage, and ...
Alana Storm's user avatar
  • 44.1k
5 votes
2 answers
8k views

There was an error processing your order. Please contact us or try again later - Paypal

I've been getting this random error that occurs when customers try to checkout using PayPal Express There was an error processing your order. Please contact us or try again later I've looked in the ...
user1704524's user avatar
  • 2,483
5 votes
3 answers
5k views

Magento 2.3: temando.CRITICAL: "accountID" is required. Enter and try again

I update Magento 2.2.6 to 2.3.1 and I have this error in which I didn't find any information : temando.CRITICAL: "accountId" is required. Enter and try again. {"exeption": "[object] (Magento\...
SylwekFr's user avatar
  • 325
5 votes
1 answer
2k views

How should I define and use a custom module Exception?

I want to create a custom Magento exception class for my module. Are there any rules for how I should do it? Where should I put the new class? How should it be thrown? I'm familiar with Mage::...
scrowler's user avatar
  • 2,004
5 votes
2 answers
1k views

Magento 2.2.1 Error(Item (Magento\SalesRule\Model\Rule) with the same ID "33" already exists)

I got an error in log like main.CRITICAL: Item (Magento\SalesRule\Model\Rule) with the same ID "33" already exists. {"exception":"[object] (Exception(code: 0): Item (Magento\SalesRule\Model\...
amith lal's user avatar
  • 756
5 votes
3 answers
2k views

Magento 1 - Get email if cron is not working / cronjob fails

I was wondering if there is an option in Magento ver. 1.9.2.2 to get an email if cron is not running or more important if a cronjob fails. I didn't find any configuration in backend nor any ...
Xavin's user avatar
  • 405
4 votes
8 answers
14k views

Why there are commands missing in bin/magento?

I need to set the application mode to developer, but when I tried doing so I got the exception [InvalidArgumentException] There are no commands defined in the "deploy:mode" namespace. Running bin/...
Adam Brinkman's user avatar
4 votes
4 answers
7k views

Uncaught Exception with no file or line number

we get an error message like this at the very bottom of our home page Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'Mage_Core_Model_Config_Element' is not allowed' in [...
Memor-X's user avatar
  • 686
4 votes
4 answers
14k views

Magento2 custom module overrides layout: The element "checkout.cart.item.renderers" already has a child with alias "simple" in exception log

In a custom module I override the cart item template. It works, but my exception log is filling up with The element "checkout.cart.item.renderers" already has a child with alias "default" and alias "...
tecjam's user avatar
  • 4,013
4 votes
1 answer
1k views

M1 CE, paypal exception "PayPal NVP gateway errors"

With the standard checkout process sometimes paypal get the money but magento dont' close the order ( making the cusotmer pay many times the order) In some orders we see 2 times rows with the sames ...
Simone Fantini's user avatar
4 votes
2 answers
3k views

Invalid webservice adapter specified

I keep receiving this error in my exception log: 2016-10-14T09:20:43+00:00 ERR (3): exception 'Mage_Core_Exception' with message 'Invalid webservice adapter specified.' in /homepages/22/d123456/...
jensusu's user avatar
  • 113
4 votes
1 answer
16k views

How to handle exception in magento 2

I have prepared one module in which I have used Image upload button. And My button is working fine unless I am not entering any "Disallowed file type". When I enter any disallowed file type it gives ...
Gaurav Agrawal's user avatar
4 votes
1 answer
329 views

Database Corruption? Double of every category filter attribute

I added a second category filter area to the category page by adding this to my local.xml: <action method="append"><block>catalog.leftnav</block></action> And output it by ...
user2565123's user avatar
4 votes
0 answers
1k views

Magento 2 : Catalog Layer has been already created

On category page I am getting this exception Catalog Layer has been already created I tried to debug it in vendor/magento/module-catalog/Model/Layer/Resolver.php, for the moment i commented the code ...
tarek fellah's user avatar
4 votes
1 answer
190 views

Overriding default magento exception handler

How would I aproach this? Everything I found so far informed me about extending magento exception handler, although I want to override, or if it's not possible then call my custom handler when ...
bestestefan's user avatar
3 votes
2 answers
7k views

Magento 2: 'Invalid sender data' While sending custom Email

Below is code that i am using send mail , and getting 'Invalid sender data' <?php namespace Mycompany\Orderupdate\Helper; use Exception; use Psr\Log\LoggerInterface; use Magento\...
Vishwas Bhatnagar's user avatar
3 votes
2 answers
12k views

Exception usage in magento2

I have created a custom controller to create customer using try catch, below is my magento1 code of controller How this can be used in magento2? try { $user = Mage::getModel('customer/...
jafar pinjar's user avatar
  • 1,839
3 votes
1 answer
5k views

Magento2 custom collection invalid method exception

I made a custom CRUD Module and when i call the collection without the addFieldToFilter function everything works fine but when i try to filter the collection i get the exception 1 exception(s): ...
Cenzo's user avatar
  • 173
3 votes
2 answers
753 views

Magento Exception log

I am getting the same exception over and over in the log, it actually making the log file very large over time. I'm really not sure how to even begin fixing this: 2016-01-14T05:30:34+00:00 ERR (3): ...
Johnnyrt's user avatar
3 votes
2 answers
4k views

Magento 2: Same ID already exists

I'm having this error when entering one certain category in frontend: Exception #0 (Exception): Item (Magento\Review\Model\Review\Summary) with the same ID "519" already exists. Any ideas what that ...
Webninja's user avatar
  • 1,561
3 votes
1 answer
9k views

How to Create Custom Error Message in Magento 2 Cart

I am trying to create custom validation for products in the Magento 2 cart. I have created a plugin: <type name="Magento\Checkout\Controller\Index\Index"> <plugin name="...
Wildcard27's user avatar
3 votes
2 answers
4k views

Increase display time of exception message in magento 2

I am using Magento 2.1.3 and I need to display an error message in the shipping information page. Currently I'm using this code: throw new StateException(__('Shipping is not available on the provided ...
amith lal's user avatar
  • 756
3 votes
1 answer
1k views

Magento2 : Not able to Log Order Details when order is Placed

I am trying to print order details in Log /return JSON result when a new order is placed. Nothing is printing in System.log or in exception.log, Please check my code below, Let me know where I am ...
JB Pakalapati's user avatar
3 votes
2 answers
384 views

Magento 1 exception log - Invalid Block type

Having an issue with my exception.log, it keeps firing these errors. I understand (i think) it has something to do with an xml block with eyemagine and expression engine. Which files should i ...
getData's user avatar
  • 327
3 votes
1 answer
5k views

What should Mage::throwException do?

I'm sorry if this is a bleedingly obvious question. I think I am going crazy. I have code that I know is stopping at a specific point. The file I am looking at is app/code/core/Mage/Downloadable/...
Sarah's user avatar
  • 860
3 votes
1 answer
2k views

Magento 2.3.3 installation with composer fails: Could not delete

I'm trying to install Magento 2.3.3 on Debian 9 over a virtual machine. I'm stuck during the magento installation process because of the magento-composer-installer plugin. I also did a manual ...
Victor Leclerc's user avatar
3 votes
2 answers
2k views

Magento2 need to throw 500 internal server error in webapi response

Can anyone let me know how to throw 500 internal error in api response with REST API? i have used below right now: throw new NoSuchEntityException( __( 'Field : '.$fields.' required.' )); but it ...
bhargav shastri's user avatar
3 votes
1 answer
2k views

'Zend_Mail_Protocol_Exception' with message '4.7.1 Connection temporarily blocked by local policy; try again later

I've started getting heaps of exceptions and my Cart2Quote emails are no longer sending. Our email server is working fine and our Cart2Quote settings haven't changed since it was working. It looks ...
travisw's user avatar
  • 678
3 votes
1 answer
6k views

Invalid argument supplied for foreach() Error in magento 2.3

I am getting this error on some Products on Magento 2.3 when I try to view them: 1 exception(s): Exception #0 (Exception): Warning: Invalid argument supplied for foreach() in /www/htdocs/...
Ken's user avatar
  • 53
2 votes
1 answer
6k views

Magento2 - ProductRepository how to catch Exception if sku does not exist

I am writing a console command to update catalog stock, but I am facing some weird issue when trying to load products by sku. I am using this code... $objectManager = \Magento\Framework\App\...
Raul Sanchez's user avatar
  • 3,144
2 votes
6 answers
5k views

how to empty .log file in magento 2?

how to empty .log file in Magento 2 from Terminal ? system.log exceptional.log debug.log
Yann Martel's user avatar
2 votes
1 answer
3k views

Magento 2.3.2 throws DOMXPath exception in backend ("Stores > Configuration") after upgrade from 2.2.7

yesterday, I upgraded a multistore Magento 2.2.7 to 2.3.2 (that was a real headache to get it done) and now I am facing a really weird problem. If I navigate (in backend) to Stores > Configuration, ...
quellcodemanufaktur's user avatar
2 votes
1 answer
42k views

There has been an error processing your request. Exception printing is disabled by default for security reasons. Error log record number: [closed]

I get an error page in Magento that states: There has been an error processing your request Exception printing is disabled by default for security reasons. Error log record number: [some ...
localhost's user avatar
  • 249
2 votes
3 answers
3k views

Programmatically create configurable products

I am trying to create a product importer in Magento. Probably exception is thrown by the line: $product->setConfigurableProductsData($configurableProductsData);. When I comment it, no exceptions ...
Marin Bînzari's user avatar
2 votes
3 answers
10k views

Magento 2: Admin Attention Something went wrong

I'm using Magento 2 CE Version 2.1.0 I already referred Magento SO post with the same error. When I'm going to Edit Any of the Product then while loading it's giving this error. Below are the ...
Jackson's user avatar
  • 9,749
2 votes
1 answer
8k views

How Mage::throwException($error) working in below code?

In magento 1.9.1 In class "Mage_Shipping_Model_Resource_Carrier_Tablerate" consider below function uploadAndImport. My question is : Mage::throwException($error) rollback transaction if there is ...
Pandurang Babar's user avatar

1
2 3 4 5 6