[Koha] Possible solution to 500 errors.

Rudy Hinojosa rudy.hinojosa at lightwavelibrary.com
Fri Sep 22 01:06:21 NZST 2023


If you are running into 500 errors, and you've exhausted all means to 
verify you have a valid biblio, a valid item record and confirmed 
homebranch is populated, there may be one more spot you need check.

Before I state what I found, this is a disclaimer. Do not attempt what I 
did without consulting with your Database Administrator or someone with 
technical experience.

===Discovery===

You may have an invalid XML structure in your table 
biblio_metadata->metadata field. Dump the xml content for the suspected 
record to your clipboard and visit any online xml validator checker 
tool. Paste it and see if it passes.

I found 134 records with invalid xml properties.

<datafield tag="500" ind1=" " ind2=" ">
     <subfield code=""">Based on the TV series SpongeBob SquarePants 
created by  Stephen Hillenburg as seen on Nickelodeon"--T.p. 
verso.</subfield>
   </datafield>

I found 134 records with triple double quotes as you see above to the 
left of the word Based.  Your koha-rebuild-zebra command should alert 
you of all xml errors. You'll really want to fix those if you don't want 
to see 500 errors.

Here's my code snippet I ran to fix this problem globally, now keep in 
mind, your xml errors may not be the same as mine, but you'll have to 
investigate your own solution:

====sql fix====

-- Step 1: Create a copy of biblio_metadata as reh_biblio_metadata
CREATE TABLE reh_biblio_metadata AS
SELECT * FROM biblio_metadata;

-- Step 2: Update the metadata field in biblio_metadata
UPDATE biblio_metadata
SET metadata = REPLACE(metadata, '=""">', '="">')
WHERE metadata LIKE '%=""%">%';

===========

then exit to system prompt and run your reindex: "koha-rebuild-zebra -f 
-a -b -v <your-koha-instance>"

Cheers!


-- 

photo 	
Rudy E. Hinojosa
CEO/President,Lightwave Library

+1 737-372-7779 <tel:+1 737-372-7779>  | lightwavelibrary.com 
<https://lightwavelibrary.com>

rudy.hinojosa at lightwavelibrary.com 
<mailto:rudy.hinojosa at lightwavelibrary.com>

25101 Ronald W. Reagan Blvd #49, Georgetown TX 78633 
<https://maps.google.com/?q=25101 Ronald W. Reagan Blvd #49, Georgetown 
TX 78633>



More information about the Koha mailing list