Using the offline database API... When trying to add a new row to an existing table with unique id's, with an id that is already present in the table and an error callback is defined, then the error code for the error in the callback is wrong. Normally it should have code == 6, for a constraint error (because the unique id is already defined in the table), however it returns code == 1. The error message however is correct. Code to reproduce (run twice, as the error will only occur after the table has been created the first time) : db = openDatabase('Test', '1.0', 'HTML5 Web Database API test', 1024*1024*1); if(db) { db.transaction(function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS test (id unique, text)'); tx.executeSql('INSERT INTO test (id, text) VALUES (1, "foobar")'); }, function(error) { /* Error callback */ alert( "Error code : " + error.code + " (should be 6)\n Error message : " + error.message ); }); } Definition or error codes : http://dev.w3.org/html5/webdatabase/#dom-sqlexception-code-constraint