Koha Solutions

Cataloging & MARC

"Something went wrong when loading the table" on a Koha record

The record opens, the holdings table does not. It is one bad row rather than a broken Koha — usually items with no home or holding library, which an import can create in seconds.

By Babar Junaid

Published 2026-11-11 · Tested against Koha 26.05

The page itself is fine — only the holdings table failed, because it is loaded separately after the page. In nearly every case one or more items on that record have no home library or no holding library, which an import that omitted MARC 952$a and 952$b produces silently. Find those rows, give them a branch, and the table loads again.

What the message says

Browser pop-up
Something went wrong when loading the table.500: Internal Server Error.Something went wrong, check Koha logs for details.

The second line is the HTTP status of the request that loads the items, and the third is what Koha's API said. A 500 is the data case on this page. A 403 means the staff account lacks a permission, and a 401 that the session expired: sign in again.

Step 1: Confirm it is that record, and read the real error

Open two or three other records first. If their tables load, the fault is data on one record and this page is the right one. If every record fails, the fault is the interface itself — go to reading the right log file instead.

The table is loaded through Koha's REST API, so the error is in the API log, not the staff interface's log. Watch it while you reload the record:

Terminal
$ sudo tail -n 0 -f /var/log/koha/library/plack-api-error.log /var/log/koha/library/api-error.log ==> /var/log/koha/library/plack-api-error.log <== ==> /var/log/koha/library/api-error.log <== ==> /var/log/koha/library/plack-api-error.log <==[2026/11/08 06:19:37] [ERROR] GET /api/v1/biblios/1/items: unhandled exception (Mojo::Exception)<<DBIC result _type  isn't of the _type Branch at /usr/share/koha/lib/Koha/Objects.pm line 452.>>
Response hidden (7 lines)
Showing the response of this command only

Response from a live run on Koha 26.05 on a fresh Ubuntu 24.04 server

isn't of the _type Branch is the tell: an item on that record has no library to look up. We reproduced exactly this on Koha 26.05 by clearing one item's home library. Any other message in that log is a different cause; the table at the end of this page lists the common ones.

Step 2: Find the items with no branch

Koha ships a read-only check that lists exactly these items, among other inconsistencies:

Terminal
$ sudo koha-shell -c "perl /usr/share/koha/bin/maintenance/search_for_data_inconsistencies.pl" library …== Not defined items.homebranch and/or items.holdingbranch ==	* Item with itemnumber=1 does not have home and holding library defined	* Item with itemnumber=2 does not have a holding library defined=> Edit these items and set valid homebranch and/or holdingbranch…
Response hidden (7 lines)
Showing the response of this command only

Response from a live run on Koha 26.05 on a fresh Ubuntu 24.04 server

Or ask the database directly, which also gives you the barcodes for a batch fix. On a terminal the result is a boxed table; in a script or piped into a file the same rows come out separated by tabs:

Terminal
$ sudo koha-mysql library -e "SELECT itemnumber, biblionumber, barcode, homebranch, holdingbranch \  FROM items WHERE homebranch IS NULL OR holdingbranch IS NULL;"+------------+--------------+---------+------------+---------------+| itemnumber | biblionumber | barcode | homebranch | holdingbranch |+------------+--------------+---------+------------+---------------+|          1 |            1 | KB-0001 | NULL       | NULL          ||          2 |            1 | KB-0002 | MAIN       | NULL          |+------------+--------------+---------+------------+---------------+
Response hidden (6 lines)
Showing the response of this command only

Response from a live run on Koha 26.05 on a fresh Ubuntu 24.04 server

Both columns are foreign keys to the libraries table, so an item cannot carry a library code that does not exist: an empty value is the only way it goes wrong. If the failing record's biblio number appears in the list, you have the cause. A missing item type does not break this table on 26.05 (it only logs a warning), so it is not worth chasing here.

Step 3: Repair the rows

Do it through the staff interface where you can: open the record, edit the item, set Home library and Current library, and save. That runs Koha's own validation and keeps the MARC and the item table in step.

For more items than anyone will edit by hand, use Tools → Batch item modification, paste the barcodes or item numbers from the query above, and set both fields in one pass.

Do not fix this with an UPDATE statement unless you have no alternative

Writing branch codes straight into items leaves the record's MARC copy saying something different, and the difference resurfaces later — at the next reindex, or the next export. If you must, take a backup first and reindex the affected records afterwards.

Stopping it happening on the next import

This is an import problem far more often than a cataloging one. A file of records from a supplier or from another system frequently carries item data in fields Koha does not read as items, or carries branch codes that do not exist in this catalog.

  • Every item needs 952$a (home library) and 952$b (holding library), and both must be branch codes that exist in Administration → Libraries.
  • Branch codes are matched exactly — MAIN and Main are two different things, and only one of them exists.
  • Import a sample of ten records before importing ten thousand, and open one of them.

The full procedure, including how to check the staged batch before committing it, is in importing MARC records into Koha.

Other causes of the same message

Where it appearsWhat it usually is
On one record, in the staff interface onlyItem rows with no home or holding library — the case above.
On every record, immediately after an upgradeThe database schema was not upgraded. Run sudo koha-upgrade-schema library, then restart Plack.
On an acquisitions receive screenThe staff account that created the order has been deleted, and the row still references it. Re-create the order, or restore the user.
On every record, with nothing in the Koha logThe request never reached Koha — a proxy or Plack fault rather than data.
403: Forbidden, only for some staffA permissions difference, not a data one. Compare the two accounts' permissions before looking at the record.

Why one bad row takes the whole table down

The holdings table is not part of the page Koha sends you. The page arrives first, and the table then asks the API for that record's items as a separate request. That is why the record's title, notes and MARC view are all perfectly fine while the table is a red message: two requests, one of which failed.

And the API builds its response one item at a time, embedding each item's home and holding library. An item with no home library has nothing to embed, the lookup fails with isn't of the _type Branch, and the whole response fails rather than returning nine good rows and one broken one. Strict is the right behaviour for an API; it is just unhelpful to look at, because the error names none of it.

The deeper point is that the database will not stop this happening. Koha's own forms will not save an item without a branch, but an import writes rows the forms never see, and so does a direct SQL fix. That is why the same message keeps arriving after a migration and almost never during ordinary cataloging.

Tested on live Koha 26.05.05

Passed all 8 checks · Read the run log

Koha release
26.05.05
System
Ubuntu 24.04
Setup
A fresh Ubuntu 24.04 server reached over SSH as a sudo user, Koha installed from the Koha repository as our installation guide leaves it.
Source read at
Koha commit d3fc229
Earlier live checks (1)
  • , Koha 26.05.02 (commit d3fc229): all 8 claims held. Read the run log
Verified against the Koha source (4 files)

The label under each command says where its response came from; a command with no label was not run live. How we test and which standards we follow.

Share this article

Holdings table still failing on some records? We find and repair the item rows behind it.