Kodi Community Forum
Help with unknown field in library - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Help with unknown field in library (/showthread.php?tid=362150)



Help with unknown field in library - teriyaki - 2021-04-18

My log is spammed with "DEBUG <general>: DatabaseUtils::GetSortFieldList: unknown field 36" and I'm not sure why. I think something in my video library is causing that. I don't want to rebuild the library right now so is there any way I can find out where exactly in the library that field is located to see what data it holds and possibly just manually remove it? I'm using a shared mariadb on Linux with all clients running the same compiled source.

Thanks guys


RE: Help with unknown field in library - Klojum - 2021-04-18

Which version of MariaDB? Also try to get the shortest debug log (wiki) possible, with debugging of course.
We'll need some sort of idea what is going on.


RE: Help with unknown field in library - teriyaki - 2021-04-18

MariaDB is version 10.5.9-1 from Debian Sid. I'm running lrusak's drmprime-2img-no-ffmpeg-bump branch (19.0-RC1-r57015-git+844e32e587) so I have HDR. This was going on before that with Kodi git prior to Matrix final. Database versions are; Addons33, ViewModes6, Textures13, MyMusic82, MyVideos119, TV37, Epg13.

Not sure what "field 36" refers to or what sql call populates what ever winds up in `GetSortFieldList`. I'm not sure how to translate that into anything in the database. I'll copy the database over to a test system and see if I can get a sane debug log. I just check current git and the video database is still at 119. Should I grab a fresh clone to test with or should my existing compile be fine?


RE: Help with unknown field in library - DaveBlake - 2021-04-19

This could be a skin issue, what skin are you using?


RE: Help with unknown field in library - teriyaki - 2021-04-19

(2021-04-19, 15:17)DaveBlake Wrote: This could be a skin issue, what skin are you using?

Using aeon nox silvo from the official repo. I tried with Estuary after you mentioned it but there was no change.


RE: Help with unknown field in library - DaveBlake - 2021-04-20

OK, good to rule out the skin.

The error message actually comes from DatabaseUtils::GetSelectFields, the 36 is from an enum list for the named fields used in sorting NOT directly a column of any databse table, and is FieldSortTitle. It is converted into a database table/view and column name by DatabaseUtils::GetField depening on the media type of the list of items being sorted, so is meaningful for TV shows and movies. It maps to columns movie_view.c10 and tvshow_view.c15 respectively, but is "unknown" for other media types.

My first blind guess (without a debug log) is that something is attempting to sort a list of items by title but that the list is not one of movies or TV shows, hence FieldSortTitle can not be mapped to a database column.

Second would be that something is wrong with the results dataset. The sorting is done on the list in memory not by the database, to do that the query results are converted from dataset into a local list and that is where this error arises. If it is TV  shows or movies being processed then something is wrong with the dataset.

The log could help indicate if either of these guesses are in the right direction.


RE: Help with unknown field in library - DaveBlake - 2021-04-20

It may also be worth noting that the last time we had odd "field unknown" errors it was related to a bug in the MariaDB connector dll and the fix was to bump that DLL to v3.1.9 (for Android specifically). That also presented with other symptoms not mentioned here, so this is not the same issue but could be a lose relative. There is limited support any of us can give to a patched pre-release build.


RE: Help with unknown field in library - teriyaki - 2021-04-20

@DaveBlake I'm still working on getting a test box set up (need to do a fresh OS install). Until then, is there any existing debugging I can enable that will send the dataset to the logfile that contains the unknown field? Thinking that would make it easier to identify where this is coming from.


RE: Help with unknown field in library - DaveBlake - 2021-04-20

What we are asking for is for you to upload the kodi.log generated after debugging has been turned on to a paste site and then post the link here. See https://kodi.wiki/view/Log_file for instructions.  I do not need the data set,  just knowing what functions are called would give clues. Since your are using cleint server there also maybe MariaDB error logs on your server that would show if there were errors server side. Again you could post links to those.

Preferably generate the log while using Estuary skin (it will simplify things).


RE: Help with unknown field in library - teriyaki - 2021-04-21

I got the test box set up, compiled a fresh clone of kodi git (kodi-r57358.git+21d347b479), copied the sql database/library over. Debug log is here


RE: Help with unknown field in library - DaveBlake - 2021-04-22

Thanks, debug shows that it is addon Library Data Provider service (set running by some skins) that is making a JSON request that results in attempting to process a results dataset and sort it by FieldSortTitle when there is no mapping for that sort field for the list item type. OK, gives me a better chance to reproduce.


RE: Help with unknown field in library - teriyaki - 2021-04-22

I don't know if this is helpful at all but I stripped down database entries seeing if it was maybe something in a table got corrupted. I emptied it out to just 1 tv show with 2 episode entries. If I delete either episode entry, the `unknown field` thing goes away. If I use a database with entries in both movie and episode tables, then empty the episode table, `unknown field` is gone. It seems like this is happening when 2 or more tv episode entries exist. Hopefully that's useful info anyways - if not, at least I'm a lot more famliar with sql now. Smile


RE: Help with unknown field in library - DaveBlake - 2021-04-22

Well thanks for trying, but this is not a database issue at all. With some help from @black_eagle I have been able to locate the cause in core code, and on checking it occurs at least as far back as Krypton (v17.0) but probably further. It isn't a new thing, although the field number in the emun has changed over time.

When a JSON API call to VideoLibrary.GetEpisodes is made using sort method "episode" (something that the Library Data Provider addon does), sorting the item list attempts to access fields FieldEpisodeNumber, FieldSeason, FieldEpisodeNumberSpecialSort, FieldSeasonSpecialSort, FieldTitle, FieldSortTitle. But for episodes FieldSortTitle is not mapped to an actual table/view and column, hence the debug message "DEBUG: DatabaseUtils::GetSortFieldList: unknown field 31" appears in the log.

This is technically a bug (accident and not design) and a very long standing one at that, but since the JSON request receives the correct results the only consequences are the log message. Your log is spammed with this message because the Library Data Provider addon is making a JSON API VideoLibrary.GetEpisodes call for every TVShow in your library. If you are not using a skin that needs the Library Data Provider addon (you were at some point and that is why it is enabled but may not be now) then I suggest you disable it.

Anyway the good news is thT there is nothing wrong with your video library. Thank you for spotting this old oddity.


RE: Help with unknown field in library - teriyaki - 2021-04-22

@DaveBlake Thank you for helping figure this out and providing a thorough explanation of the cause. Thankfully the video library is not corrupted somehow and the bug is purely logfile cosmetics! Also thanks to @black_eagle, @Klojum , and anyone who helped as well - it's greatly appreciated! The aeon knox silvo skin (what we normally use) still depends on Library Data Provider but resolving the log spam was easy armed with the findings.

Cheers