Question of the Quarter - How to deal with 500 errors

Question of the Quarter - How to deal with 500 errors

This document will outline how we resolved some interesting questions that have come up in the last few months:

What does it mean when a table on Koha is showing a 500 error and how can it be addressed?

Info
Key takeaways:
A 500 error on a table in Koha usually indicates malformed data in the table

How to over - ride a 500 error

How to create a simple report to see all fields in an item record

How to find a biblionumber

Your first thought on how to resolve an issue might work, but that doesn't mean it is the easiest option!

This document is intended not only to explain how to resolve a specific issue on Koha but unlike standard FAQs, the process of resolving the issue will also be outlined. The aim of explaining how Interleaf Technology staff came to a resolution is to help our clients in their own approach to challenges on their system and demystify the support process. Finding the solution to a problem sometimes doesn't leave much room to explain in detail how we reached our conclusions so we want to give an insight into our work processes, 

500 Error

These errors tend to come up when trying to directly view a table on Koha. I most frequently see it occurring on the item table or on a table which pulls information from the item record itself e.g.: baskets in the acquisitions module, but it can happen anywhere on the system. For this document, I have used an example that was sent in a few months ago where a site couldn't view the details of the items on a specific bibliographic record.

A 500 error can be frustrating as it often doesn't show details of why it is appearing, such as in the below image. It just blocks a record from displaying without indicating how to solve the problem.


In this example, a staff member had completed a search for a title and the results were not displaying in full due to the error. After clicking the Ok button in the error popup, the staff member was taken to the record, but the items table was still stuck loading.

Errors like these tend to indicate one thing: there is a malformed piece of data in the table. The question is, if we can't view the items table directly then how do we know what information is causing the problem, let alone how to edit it and resolve the issue?

How did Interleaf Technology staff  approach resolving this issue?

I knew I needed to see the content of the table but as the table was not loading I had to figure out a workaround to view the fields. My first thought was to create a report showing the content of the fields. This was my initial approach because I have experience creating reports and I was confident it would be a small report using very few tables. This would reduce the risk of overwhelming the system and wouldn't take up much time to complete.

The report

Creating a simple, targeted report is a straightforward way of discovering information about a table which is not loading.
Warning
As always, we advise caution when working with an unfamiliar report and if you have access to a testing site then the reports should be run there first and only moved to the live if it does not impact on the system. If you create your own report and have any questions or concerns about the safety of running it on the live site, please contact us on our Support Portal.

In this example, the table showing an error is the item table so I used a simple report in the following format:

SELECT *
FROM items
WHERE biblionumber = "35550639"

This report looks at all the content in the items table but it uses the WHERE function to limit the report to a specific bibliographic record. This prevents the report from bringing back all information from all items on the system and potentially slowing the system. 

Warning
It is very important to only run a report such as the one outlined above with a function that will limit the number or results that are returned. Running a report to see all information from all items on the site would be resource intensive and might slow the system.

Notes
For more information about finding a biblionumber please check our Help Centre or contact Interleaf Technology directly.

This returns information about items attached to the identified bibliographic record.


This is a very long table so it can be intimidating as you start to scroll across to the right hand side to view all the fields however there are common problems to look out for.

Common issues

The most common fields for issues are the barcode, homebranch, holdingbranch, itype, location and ccode.

If you're ever looking at the content of a table trying to determine why it is giving a 500 error ask the following questions:

Question
What does this indicate?
Is there content in the itemnumber, biblionumber, biblioitemnumber and barcode fields?
If the answer is no to any of these then the empty field is likely what is causing the issue.
Does the content in the itype, ccode and location fields look similar to the format of content on my site?
If the answer is no to any of these then the empty field is likely what is causing the issue.
Are the date fields using a "00-00-000" or any variation involving zeros?
If the answer is yes then this is likely what is causing the issue.

This is not a definitive list of areas that might be causing the error, but they are a good way to start looking at the items table. Being able to figure out the problem can be influenced by many factors including your knowledge of the specific system, how the information was added to a table and changing standards for how information is expected to be formatted on Koha. With all of this in mind, do not be discouraged if it is not immediately clear why the error is appearing.

Notes
If you have created a report and still can't see what the issue with table is, please contact Interleaf Technology directly.
In this case, I noticed that the format of the item type did not match the format of the other item types that were on the site, which indicated that the item type had to be edited on one of the items attached to the identified bibliographic record.


Alternative to a report - Edit the item records

After I had identified the field in the item table that was likely causing an issue I went back to the original record. It was still showing an error and the table was still stuck loading but I had to figure out a way to view the content of the table. There was no secret trick for doing this, I just considered the options on the page in front of me and decided to experiment with the Edit button at the top of the page. This was how it occurred to me that by going into the edit the item records option would allow me to view the details of the records. With this in mind, I knew in future, I could start by editing the item records rather than taking the time to create a report.

When a record is stuck loading the item table, click the Edit button at the top of the record.

This will create a dropdown menu of options. Click Manage items.

This will open a new page of the record where new items can be attached and more importantly, details of the existing items can be viewed. 

It was only after I had done this that is was obvious I could have started my investigation by doing this! When this query came in again, my first step was to check the items on the record directly. It was only if looking through the items on the table didn't give any clues as to the issue that I then would create a report to get more information.


Go to the item records at the top of the page and click the Actions button on the first one. This will create a dropdown menu. Select Edit from the menu.


This will populate the Add item form with the information from the selected item record. 


Go through the fields to check if any show any specific errors. In this example, we can see the item type field is showing an error:



The y - Koha item type field is showing content but it includes a message that the item type is Not an authorised value, an authorised value being a defined entry for a dropdown list on Koha. This means that the item record has an entry that is not part of the standard options for item types on this system.

Notes
For more information on item types please check our Help Centre or contact Interleaf Technology.

This can occur for a number of reasons. In this specific example, the bibliographic record had been imported to the site and had content in the 942$c field, which included a bibliographic level item type specific to the site the record was exported from that did not appear on the site the record was imported to. As the record was imported and not manually created the hard coded authorised values were overwritten. 

To resolve the issue we changed the item type in the y - Koha item type field and then saving off the record. 
Once the malformed data has been updated the table loads correctly. 


Final Thoughts

There is no one single reason for a 500 error to appear, so it may take some investigation to identify the faulty format of the information. However, the more familiar you become with your site and the standard appearance of information on it, the easier it will be to identify when something doesn't look right. Don't be discouraged, sometimes finding the right answer if about trial and error.


VersionDateDetailAuthor
1.011/11/25Document createdHolly Cooper
1.209/12/25Adding detailsHolly Cooper
1.329/12/25Adding detailsHolly Cooper

































    • Related Articles

    • How to Create a New Item Type

      Patron categories are important because they are used within the fine and circulation rules to determine which items can be taken out by which patrons and for how long. They also be used to determine global functions on individual items, for example, ...
    • How to set a bibliographic level item type

      This document will outline how to set Koha to use bibliographic level item types rather than item level items types for circulation. It is possible to provide item level items types on individual item records while at the same time use an overall ...
    • How to set set a lost charge at the item type level

      This document will outline how to set a default charge for Lost items at the item type level. This function is useful when there is a standard charge every item which is categorised into a specific item type. For more information on the fields on the ...
    • How to group item types using parent item types

      Item types are used by the fine and circulation rules to determine how many items can be checked out and by which patrons. It is possible to link item types to each other by assigning a parent item type which allows libraries greater control over ...
    • How to set circulation rules for parent item types

      Item types are used by the fine and circulation rules to determine how many items can be checked out and by which patrons. It is possible to link item types to each other by assigning a parent item type which allows libraries greater control over ...