Need help with an error message I'm getting - don't understand the error!

I’m following the example from the Discover Meteor book for my own application and I’m getting an error when inserting the record:

Exception in delivering result of invoking ‘artistInsert’: assert

I’ve verified that the data is being inserted into the collection, but I still get this error and doesn’t return to the page I’ve set in the Router.go method.

The js calling code:{
‘submit form’: function(e) {

var artistInfo = {
  name: $('[name=artistName]').val(),
  genre: $('[name=artistGenre]').val()
};'artistInsert', artistInfo, function(error, result) {
  // display the error to the user and abort
  if (error)
    return alert(error.reason);
    // show this result but route anyway
  if (result.artistExists)
      alert('This artist has already been added.');


My artists.js method within /lib/collections/artist.js:

Artists = new Mongo.Collection(‘artists’);

artistInsert: function(artistAttributes) {
check(this.userId, String);
check(artistAttributes, {
name: String,
genre: String

var artistWithSameName = Artists.findOne({name:});
if (artistWithSameName) {
  return {
    artistExists: true,
    _id: artistWithSameName._id
var user = Meteor.user();
var theArtist = _.extend(artistAttributes, {
  userId: user._id,
  owner: user.username,
  added: new Date()
var artistId = Artists.insert(theArtist);

return {
  _id: artistId


I solved it and thought I’d post here in case someone else comes across the problem. The issue was with my routing. Changed: