Error happened [Error: Invalid character entity

Please help
I get this error message when i try to use the ionic command from the terminal for example: ionic platform add android

I am using a macbook pro

Error happened [Error: Invalid character entity
Line: 3
Column: 23
Char: ]
Error: Invalid character entity
Line: 3
Column: 23
Char:
at error (/usr/local/lib/node_modules/ionic/node_modules/xml2js/node_modules/sax/lib/sax.js:642:8)
at strictFail (/usr/local/lib/node_modules/ionic/node_modules/xml2js/node_modules/sax/lib/sax.js:662:22)
at Object.write (/usr/local/lib/node_modules/ionic/node_modules/xml2js/node_modules/sax/lib/sax.js:1336:11)
at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:403:31)
at Parser.parseString (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:6:61)
at Object.exports.parseString (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:433:19)
at /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/config-xml.js:23:12
at /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/ionic-cordova-lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:76:16
at tryToString (fs.js:414:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)

From the stack trace, I would say that your config.xml is wrong on line 3 / column 23, maybe you used & character.

7 Likes

Hey thanks @gmarziou
You saved my life: I had the same issue; the cause was a typo in my config.xml.
Ether way, it would be nice if the system could address the issue in a less cryptic way.
I lost a whole day trying to understand the reason why my project ceased to work (apparently) out of the blue.

Thanks again for the heads up!
Cheers
Aa

1 Like

Exactly the same here, it was also a problem in my config.xml !

I was having the same issue, it was in config.xml file
I found in my config.xml a charachter “&” inside the description tag, once I removed it the issue gone.

1 Like

WOW it really solve my problem too.
it was found at CONFIG.XML as showing at image below “&” image

1 Like

Thanks. It was occurring because of the ‘&’ character in my config.xml file.

Thanks. Had the same ‘&’ issue also. :slight_smile:

i had the ‘&’ char in the config file. Thank you for pointed that out

I should thank you @gmarziou, I had also a & character in the description, it’s the first time I face this problem and the first solution I found is yours so Thank you again

I love you :heart_eyes:

Everyone is loving the answer. Thanks Gael. Now in terms of why the ampersand character is not allowed within the config.xml file, can @gmarziou or someone else on the thread explain if that’s a general xml requirement or something else. And what’s a workaround?

I have the same issue, now solved because of @marwan @gmarziou.
thank you so many guys for the weird issue’s great answer.