Monday, January 17, 2011

Breaking Koha

(following is mostly for my benefit)  In playing with the test version of Koha (just doing the simple things), I managed to break it.  After deleting a record, OPAC searches return the following error:

Can't call method "as_usmarc" on an undefined value at /usr/share/koha/lib/C4/ line 2384.

It took a bit of search in Google but I did come across this post from Mason James.  His recommendation is to run:

./bin/migration_tools/ *or*./bin/migration_tools/

Problem is that if you run the above from /usr/share/koha, you receive complaints about not being able to find the Perl module C4::Context. The solution is to run the script with the full path, like:


The above rebuilds the BIBLIO and AUTHORITIES indexes and you should be able to search via the OPAC page again.


  1. I think that the issue may have been caused by deleting a record without bothering to delete the item attached to it.

  2. Have anyone else tried out this command? Does it really work or create more problems?

  3. I tried the command but the followin error appears:

    Can't locate C4/ in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/share/koha/bin/migration_tools/ line 3.
    BEGIN failed--compilation aborted at /usr/share/koha/bin/migration_tools/ line 3.

    Can anybody suggest a solution?


  4. You ran the command as root, using the full path? How about as the koha user?