Skip to content

Instantly share code, notes, and snippets.

@wdiechmann
Created March 6, 2015 10:38
Show Gist options
  • Save wdiechmann/63566c838025ab16ed1f to your computer and use it in GitHub Desktop.
Save wdiechmann/63566c838025ab16ed1f to your computer and use it in GitHub Desktop.
Trace of an error when trying to insert a record into a MySQL table
```
(0.1ms) ROLLBACK
ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect string value: '\xE5 vide...' for column 'body' at row 1: INSERT INTO `messages` (`title`, `msg_from`, `msg_to`, `body`, `created_at`, `updated_at`) VALUES ('Fwd: Kan ikke leveres: Re: test - svar', '[email protected]', '[email protected]', '<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n</head>\n<body dir=\"auto\">\n<div>Pis<br>\n<br>\nMed venlig hilsen\n<div>Walther</div>\n</div>\n<div><br>\nStart p? videresendt besked:<br>\n<br>\n</div>\n<blockquote type=\"cite\">\n<div><b>Fra:</b> Microsoft Outlook &lt;<a href=\"mailto:MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@korpskontoret.onmicrosoft.com\">MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@korpskontoret.onmicrosoft.com</a>&gt;<br>\n<b>Dato:</b> 6. mar. 2015 kl. 03.34.44 CET<br>\n<b>Til:</b> &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;<br>\n<b>Emne:</b> <b>Kan ikke leveres: Re: test - svar</b><br>\n<br>\n</div>\n</blockquote>\n<div><span></span></div>\n<blockquote type=\"cite\">\n<div>\n<p><b><font color=\"#000066\" size=\"3\" face=\"Arial\"><a href=\"http://baruwa.alco.dk\">baruwa.alco.dk</a> har afvist din meddelelse til f?lgende mailadresser:</font></b></p>\n<font color=\"#000000\" size=\"2\" face=\"Tahoma\"></font>\n<p><font color=\"#000000\" size=\"2\" face=\"Tahoma\"><a href=\"mailto:[email protected]\">[email protected] ([email protected])</a><br>\n</font><font color=\"#000000\" size=\"3\" face=\"Arial\">Der opstod et problem under levering af meddelelsen til denne mailadresse. Pr?v at sende meddelelsen igen. Kontakt din mailadministrator, hvis problemet forts?tter.<br>\n</font><font color=\"#000000\" size=\"2\" face=\"Tahoma\"><br>\n</font></p>\n<p><font color=\"#000000\" size=\"2\" face=\"Tahoma\"><b><a href=\"http://baruwa.alco.dk\">baruwa.alco.dk</a> udl?ste denne fejl:<br>\nThe email address does not exist <br>\n</b></font></p>\n<font color=\"#000000\" size=\"2\" face=\"Tahoma\">\n<p></p>\n</font><br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<font color=\"#808080\" size=\"2\" face=\"Tahoma\">\n<p><b>Diagnosticeringsoplysninger for administratorer:</b></p>\n<p>Genererende server: <a href=\"http://DB3PR04MB091.eurprd04.prod.outlook.com\">DB3PR04MB091.eurprd04.prod.outlook.com</a><br>\n</p>\n<p><a href=\"mailto:[email protected]\">[email protected]</a><br>\n<a href=\"http://baruwa.alco.dk\">baruwa.alco.dk</a><br>\nRemote Server returned \'550 The email address does not exist\'<br>\n</p>\n<p>Oprindelige brevhoveder:</p>\n<pre>Received: from <a href=\"http://DB3PR04MB0762.eurprd04.prod.outlook.com\">DB3PR04MB0762.eurprd04.prod.outlook.com</a> (25.160.51.153) by\n <a href=\"http://DB3PR04MB091.eurprd04.prod.outlook.com\">DB3PR04MB091.eurprd04.prod.outlook.com</a> (10.242.129.23) with Microsoft SMTP\n Server (TLS) id 15.1.106.15; Fri, 6 Mar 2015 02:34:43 &#43;0000\nReceived: from <a href=\"http://DB3PR04MB0762.eurprd04.prod.outlook.com\">DB3PR04MB0762.eurprd04.prod.outlook.com</a> (25.160.51.153) by\n <a href=\"http://DB3PR04MB0762.eurprd04.prod.outlook.com\">DB3PR04MB0762.eurprd04.prod.outlook.com</a> (25.160.51.153) with Microsoft SMTP\n Server (TLS) id 15.1.106.15; Fri, 6 Mar 2015 02:34:42 &#43;0000\nReceived: from <a href=\"http://DB3PR04MB0762.eurprd04.prod.outlook.com\">DB3PR04MB0762.eurprd04.prod.outlook.com</a> ([25.160.51.153]) by\n <a href=\"http://DB3PR04MB0762.eurprd04.prod.outlook.com\">DB3PR04MB0762.eurprd04.prod.outlook.com</a> ([25.160.51.153]) with mapi id\n 15.01.0106.007; Fri, 6 Mar 2015 02:34:42 &#43;0000\nFrom: =?iso-8859-1?Q?Walther_H=F8jgaard_Diechmann?= &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;\nTo: &quot;<a href=\"mailto:[email protected]\">[email protected]</a>&quot; &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;\nSubject: Re: test - svar\nThread-Topic: test - svar\nThread-Index: AQHQV7WZZcTIeE/oPEKTqzYlMc3gzZ0OvMjh\nDate: Fri, 6 Mar 2015 02:34:42 &#43;0000\nMessage-ID: &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;\nReferences: &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;\nIn-Reply-To: &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;\nAccept-Language: da-DK, en-US\nContent-Language: da-DK\nX-MS-Has-Attach:\nX-MS-TNEF-Correlator:\nx-originating-ip: [78.156.121.198]\nauthentication-results: <a href=\"http://alco.dk\">alco.dk</a>; dkim=none (message not signed) header.d=none;\nx-microsoft-antispam:\n UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB3PR04MB0762;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB3PR04MB091;\nx-forefront-antispam-report: BMV:1;SFV:NSPM;SFS:(10019020)(6039001)(479174004)(15187005004)(16236675004)(83716003)(15395725005)(36756003)(87936001)(86372001)(82746002)(18206015028)(66066001)(40100003)(76176999)(102836002)(16799955002)(50986999)(54356999)(19580395003)(2501003)(86362001)(46102003)(110136001)(74482002)(15975445007)(107886001)(2351001)(122556002)(450100001)(2950100001)(2900100001)(33656002)(19580405001)(77156002)(92566002)(2656002)(62966003)(558084003)(106116001)(15398625002)(104396002)(18926415006);DIR:OUT;SFP:1102;SCL:1;SRVR:DB3PR04MB0762;H:DB3PR04MB0762.<a href=\"http://eurprd04.prod.outlook.com\">eurprd04.prod.outlook.com</a>;FPR:;SPF:None;MLV:sfv;LANG:nb;\nx-microsoft-antispam-prvs: &lt;<a href=\"mailto:DB3PR04MB07623095783E3FD1344886ECBB1C0@DB3PR04MB0762.eurprd04.prod.outlook.com\">DB3PR04MB07623095783E3FD1344886ECBB1C0@DB3PR04MB0762.eurprd04.prod.outlook.com</a>&gt;\nx-exchange-antispam-report-test: UriScan:;\nx-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5002007)(5005006);SRVR:DB3PR04MB0762;BCL:0;PCL:0;RULEID:;SRVR:DB3PR04MB0762;\nx-forefront-prvs: 05079D8470\nContent-Type: multipart/alternative;\n boundary=&quot;_000_778DD5B860634326BAF1B05343286A4Csl2017dk_&quot;\nMIME-Version: 1.0\nX-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2015 02:34:42.0043\n (UTC)\nX-MS-Exchange-CrossTenant-fromentityheader: Hosted\nX-MS-Exchange-CrossTenant-id: 69579a26-02bd-4b0f-bae7-9d345c7111ea\nX-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR04MB0762\nReturn-Path: <a href=\"mailto:[email protected]\">[email protected]</a>\nX-OriginatorOrg: <a href=\"http://sl2017.dk\">sl2017.dk</a>\n</pre>\n</font></div>\n</blockquote>\n<blockquote type=\"cite\">\n<div></div>\n</blockquote>\n</body>\n</html>\n', '2015-03-06 09:36:07.068623', '2015-03-06 09:36:07.068623')
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `block in execute'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `block in log'
from /Users/walther/.gem/ruby/2.1.2/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:460:in `log'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `execute'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/mysql2_adapter.rb:248:in `exec_insert'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/relation.rb:64:in `insert'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/persistence.rb:521:in `_create_record'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/counter_cache.rb:139:in `_create_record'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/attribute_methods/dirty.rb:127:in `_create_record'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/callbacks.rb:306:in `block in _create_record'
from /Users/walther/.gem/ruby/2.1.2/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:117:in `call'
... 30 levels...
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/transactions.rb:286:in `block in save'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/transactions.rb:285:in `save'
from /Users/walther/.gem/ruby/2.1.2/gems/activerecord-4.2.0/lib/active_record/persistence.rb:34:in `create'
from /Users/walther/Documents/Projects/Rails/sl2017/app/jobs/trawl_mail_accounts_job.rb:37:in `parse'
from /Users/walther/Documents/Projects/Rails/sl2017/app/jobs/trawl_mail_accounts_job.rb:23:in `block in perform'
from /Users/walther/Documents/Projects/Rails/sl2017/app/jobs/trawl_mail_accounts_job.rb:19:in `each'
from /Users/walther/Documents/Projects/Rails/sl2017/app/jobs/trawl_mail_accounts_job.rb:19:in `perform'
from (irb):1
from /Users/walther/.gem/ruby/2.1.2/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
from /Users/walther/.gem/ruby/2.1.2/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /Users/walther/.gem/ruby/2.1.2/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/walther/.gem/ruby/2.1.2/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/walther/.gem/ruby/2.1.2/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'irb(main):002:0> quit
$ bundle exec rails dbconsole
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1064
Server version: 5.6.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> INSERT INTO `messages` (`title`, `msg_from`, `msg_to`, `body`, `created_at`, `updated_at`) VALUES ('Fwd......
Query OK, 1 row affected (0.00 sec)
mysql> quit
Bye
$ bundle exec rails -v
Rails 4.2.0
$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment