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
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:
$ 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 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:
$ 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 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:
$ 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 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
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) and952$b(holding library), and both must be branch codes that exist in Administration → Libraries. - Branch codes are matched exactly —
MAINandMainare 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 appears | What it usually is |
|---|---|
| On one record, in the staff interface only | Item rows with no home or holding library — the case above. |
| On every record, immediately after an upgrade | The database schema was not upgraded. Run sudo koha-upgrade-schema library, then restart Plack. |
| On an acquisitions receive screen | The 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 log | The request never reached Koha — a proxy or Plack fault rather than data. |
403: Forbidden, only for some staff | A 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)
- koha-tmpl/intranet-tmpl/prog/js/datatables.js (lines 411-437)
- koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (lines 306-315)
- misc/maintenance/search_for_data_inconsistencies.pl (lines 30-42)
- installer/data/mysql/kohastructure.sql (lines CREATE TABLE items)
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.
Holdings table still failing on some records? We find and repair the item rows behind it.
Related
More on cataloging & marc
Answers to the questions that usually arrive with this one.
Broken characters (�, é) in Koha after a MARC import
Diamonds with question marks, or é shown as é, mean the file was staged under the wrong character encoding. The characters cannot be repaired in Koha; undo the batch and import again with the right encoding.
Importing MARC records into Koha
Staging first, committing second — and the reason that two-step design is the most useful safety feature Koha has. With the command-line equivalents for files too big for a browser.
MARC21 or UNIMARC: the choice you cannot undo
Koha asks for a MARC flavour before you catalogue anything, and changing it later means re-importing the catalogue. Unless you have a specific reason, choose MARC21.
Adding a Z39.50 target to Koha for copy cataloging
Add a remote catalog once and your catalogers stop typing records by hand. The settings, the targets that answer today, how to put your preferred source first, and why a search returns nothing.

