JSONRPC Error: Invalid params.
#1
Hi all,

I've posted a similar question on the official iOS remote Kodi forum but I have no luck with an answer so I am going to try a different tack. I have updated to Isengard Beta 1 v15.0 and since then (I think) I have been receiving JSON-RPC errors when trying to browse my media collection by genre through iPad apps.

Regardless of the app I get this error.

ImageImage

Luckily one of the apps has a debug mode.

Code:
//////////////////// REQUEST //////////////////

{
    endTime = "2015-06-04 22:15:29 +0000";
    id = "-356594679";
    methodCall =     {
        id = "-356594679";
        jsonrpc = "2.0";
        method = "VideoLibrary.GetGenres";
        params =         {
            limits =             {
                end = 5000;
                start = 0;
            };
            properties =             (
            );
            sort =             {
                ignorearticle = 0;
                method = label;
                order = ascending;
            };
            type = movie;
        };
    };
    startTime = "2015-06-04 22:15:29 +0000";
}

|||||||||||||||||| RESPONSE ||||||||||||||||||||

{
    id = "-356594679";
    jsonrpc = "2.0";
    result =     {
        genres =         (
                        {
                genreid = 3;
                label = Action;
            },
                        {
                genreid = 7;
                label = Adventure;
            },
                        {
                genreid = 6;
                label = Animation;
            },
                        {
                genreid = 20;
                label = Biography;
            },
                        {
                genreid = 8;
                label = Comedy;
            },
                        {
                genreid = 11;
                label = Crime;
            },
                        {
                genreid = 25;
                label = Documentary;
            },
                        {
                genreid = 1;
                label = Drama;
            },
                        {
                genreid = 9;
                label = Family;
            },
                        {
                genreid = 10;
                label = Fantasy;
            },
                        {
                genreid = 22;
                label = History;
            },
                        {
                genreid = 2;
                label = Horror;
            },
                        {
                genreid = 30;
                label = Indie;
            },
                        {
                genreid = 17;
                label = Music;
            },
                        {
                genreid = 18;
                label = Musical;
            },
                        {
                genreid = 12;
                label = Mystery;
            },
                        {
                genreid = 14;
                label = Romance;
            },
                        {
                genreid = 4;
                label = "Sci-Fi";
            },
                        {
                genreid = 26;
                label = "Science Fiction";
            },
                        {
                genreid = 28;
                label = Short;
            },
                        {
                genreid = 21;
                label = Sport;
            },
                        {
                genreid = 16;
                label = Suspense;
            },
                        {
                genreid = 5;
                label = Thriller;
            },
                        {
                genreid = 19;
                label = War;
            },
                        {
                genreid = 15;
                label = Western;
            }
        );
        limits =         {
            end = 25;
            start = 0;
            total = 25;
        };
    };
}

//////////////////// REQUEST //////////////////

{
    endTime = "2015-06-04 22:15:30 +0000";
    id = 40421956;
    methodCall =     {
        id = 40421956;
        jsonrpc = "2.0";
        method = "VideoLibrary.GetMovies";
        params =         {
            filter =             {
                genre = Crime;
            };
            limits =             {
                end = 50;
                start = 0;
            };
            properties =             (
                thumbnail,
                file,
                year,
                sorttitle,
                runtime,
                dateadded,
                title,
                playcount,
                resume
            );
            sort =             {
                ignorearticle = 1;
                method = label;
                order = ascending;
            };
        };
    };
    startTime = "2015-06-04 22:15:30 +0000";
}

|||||||||||||||||| ERROR ||||||||||||||||||||

DSJSONRPC Error: Invalid params. (Code: -32602) - Data: (null)

My question is, is this just something that is due to the beta and will be sorted on release or is my media at fault?

My media is handled by Media Center Master so there is little input from Kodi in terms of tagging.

Here is my Kodi log.

The Kodi log, JSON-RPC log and screenshots were all on separate occasions but of the same error.

Any ideas about what is going on would be much appreciated.

Thanks
Doug
Reply
#2
this question really needs to be answered in that apps forum.
Trouble is that log isn't even valid json. Its apparently something sanitized by the app for display and or use by the app developers...
Also it doesn't exactly specify if the last request listed in the log is the last one that passed or this one that fails...
Which in this case is a bit confusing because the log states it last did a request for the Crime genre, but in the app screenshot it appears it last did a request for the Horror genre.
One can postulate what the bad request is trying to do, but its only suggesting how its doing it.
That said as long as Horror is a valid genre, which i have no idea if is or not, then the rest of the data would appear to me valid...
Again as long as they format it in the correct json 2.0 format which they are not in the log.

I would guess that the listing of genres is cached or static, and there may not be a horror genre in your library and that might be screwing up the app.
put something in as horror, resync the library and see what happens... else ditch anything horror resync and then see what happens
That is just speculation on my part.
Reply
#3
Code:
13:25:03 T:1372   ERROR: SQL: SQL error or missing database
                                            Query: select * from movie_view JOIN genre_link ON genre_link.media_id=movie_view.idMovie AND genre_link.media_type='movie' JOIN genre ON genre.genre_id=genre_link.???
                                            _id WHERE genre.name like 'Documentary'
13:25:03 T:1372   ERROR: CVideoDatabase::GetMoviesByWhere failed

Looks like the database migration failed when first booting Isengard. There are a few threads (and PRs: see PR7231, PR7048, PR6020) discussing such migration failures, and work is ongoing to rectify the issue before release.

Your options are:

1) Delete your MyVideos92 database and go back to whatever Kodi build you were using previously (and wait for the migration issues to be resolved before trying again)

2) Delete your old database/library, and rescan your media from scratch using the new Beta (ie. avoid the database migration)

3) Identify and fix the problems in your working MyVideosXX database so that the Isengard database migration succeeds
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#4
Eek ill try to stick to what i know... nothing...
Reply
#5
Thank you for you suggestions Milhouse.

I removed all my video sources. Cleaned my library and deleted all the MyVideoxx and MyTVxx .db files. I let Isengard beta rebuild my libraries but unfortunately the error still persisted.

I repeated moving a few test video files into fresh folders without any previous meta-information files (since media center master can create and download extra stuff) and let Kodi scrape meta information. The error still persisted.

I have begrudgingly rolled back to Helix 14.2 and everything works again. I can only presume the error is due to something in the beta.

I shall be more patient in the future and wait for a stable Isengard release.

Regards

Doug
Reply
#6
(2015-06-06, 16:45)DougD Wrote: I removed all my video sources. Cleaned my library and deleted all the MyVideoxx and MyTVxx .db files. I let Isengard beta rebuild my libraries but unfortunately the error still persisted.

I repeated moving a few test video files into fresh folders without any previous meta-information files (since media center master can create and download extra stuff) and let Kodi scrape meta information. The error still persisted.

You definitely had a migration issue, but this may have been a coincidence.

Unfortunately the information you have posted so far isn't much help, as it's been mangled by whatever tool you are using on your iPad and the request/response details are no longer valid JSON.

The "filter" on the "VideoLibrary.GetMovies" request isn't valid in any Kodi version, but this may be because of the iPad mangling, so reproducing your problem isn't currently possible unless you can post the *exact* JSON requests that are being made by Kodi Isengard: Enable JSON-RPC in component-specific logging and upload another debug log from the Isengard Beta.

(2015-06-06, 16:45)DougD Wrote: I have begrudgingly rolled back to Helix 14.2 and everything works again. I can only presume the error is due to something in the beta.

I shall be more patient in the future and wait for a stable Isengard release.

I doubt anything JSON-RPC related is going to change between now and Isengard release, so unless you can provide more accurate information you'll be stuck on 14.2 for quite a while.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#7
I'm not sure if this is any help.

Here is the debug file with verbose JSON-RPC logging switched on in 14.2 and 15.0 Both version I have searched for the Horror' genre'.

14.2. Kodi Log - Genre filter Success

14.2 App debug log showing request and response


15.0. Kodi Log - Genre filter Failure
15.0 App debug log showing request and response

I have not touched the media inbetween installs.

Regards
Doug
Reply
#8
Again your Kodi 15/Isengard database is broken.

The query you're trying to execute:
Code:
curl -X POST -H "Content-Type: application/json" -d '{"method":"VideoLibrary.GetMovies","id":-1368034996,"jsonrpc":"2.0","params":{"sort":{"order":"ascending","method":"label","ignorearticle":true},"filter":{"genre":"Horror"},"properties":["thumbnail","file","year","sorttitle","runtime","dateadded","title","playcount","resume"],"limits":{"start":0,"end":50}}}' http://localhost:8080/jsonrpc

works for me on both Kodi 15.x (latest master) and Kodi 14.x, both OpenELEC on RPi with MySQL backend, but then my database isn't broken.

The reason it doesn't work for you:
Code:
18:34:14 T:5244   DEBUG: JSONRPC: Incoming request: {"method":"VideoLibrary.GetMovies","id":-1368034996,"jsonrpc":"2.0","params":{"sort":{"order":"ascending","method":"label","ignorearticle":true},"filter":{"genre":"Horror"},"properties":["thumbnail","file","year","sorttitle","runtime","dateadded","title","playcount","resume"],"limits":{"start":0,"end":50}}}
18:34:14 T:5244   ERROR: SQL: SQL error or missing database
                                            Query: select * from movie_view JOIN genre_link ON genre_link.media_id=movie_view.idMovie AND genre_link.media_type='movie' JOIN genre ON genre.genre_id=genre_link.p^)^T^A_id WHERE genre.name like 'Horror'
18:34:14 T:5244   ERROR: CVideoDatabase::GetMoviesByWhere failed
Your Isengard database is broken.

Not sure if you did a migration this time or started afresh, but somehow your Isengard MyVideos92 database has not been created successfully - since this is highly unlikely with a fresh database I'm having to assume you attempted another migration from your MyVideos90.db.

With a migration issue such as this, I'd suggest enabling debug, deleting MyVideos92.db, restarting Kodi (Isengard Beta) and then uploading the subsequent debug log so that the database migration (and it's failure) can be analysed, although it's almost certainly covered by one of the Pull Requests I listed previously.

If you're saying it fails with a fresh (non-migrated and thus empty) MyVideos92 database then you should capture that debug log as this is quite probably a failure mode that hasn't been seen before. Backup and then rename/delete all of your MyVideos* databases, enable debugging, restart Kodi Isengard Beta, and test your JSON query - if it fails then upload the debug log.

Edit: The *only* other possibility is that the SQL being executed, is invalid - it seems to contain "p^)^T^A_id" which may just be an artefact of the logging, or the SQL is in fact invalid:
Code:
Query: select * from movie_view JOIN genre_link ON genre_link.media_id=movie_view.idMovie AND genre_link.media_type='movie' JOIN genre ON genre.genre_id=genre_link.p^)^T^A_id WHERE genre.name like 'Horror'
When I execute the JSON request on Kodi 15/RPi/OpenELEC, the executed SQL is:
Code:
20:16:19 67113.882812 T:1663734848   DEBUG: RunQuery took 46 ms for 26 items query: select * from movie_view JOIN genre_link ON genre_link.media_id=movie_view.idMovie AND genre_link.media_type='movie' JOIN genre ON genre.genre_id=genre_link.genre_id WHERE genre.name like 'Horror'
So maybe somebody would be so kind as to reproduce this on a Windows build - my guess would be this is due to some buffer/pointer nonsense that is affecting Windows builds and that "p^)^T^A" is a pointer to a string buffer that should hold "genre" but instead the value of the pointer is being spat out.

Edit2: It's a bug in the code - the SQL query is being contructed here and there are 5 formatting options but only 4 arguments, so that final option is gibberish... amazing it works at all...
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#9
@DougD: I've created PR7237 which should hopefully fix this before release - thanks for bringing this up and apologies for sending you on a wild goose chase! Smile
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#10
I've been testing some more.

Here is the log with your first suggestion. Kodi 14.2 to 15.0 - creation of MyVideos92.db from Myvideo90.db
No errors appear in log except when I try to filter by genre from an app.

Here is your second suggestion where 15.0 beta created a myvideos92.db from scratch. Log file

Now here's the thing. I have loaded the newly created myvideo92.db into a sqllite editor and run the query

select * from movie_view JOIN genre_link ON genre_link.media_id=movie_view.idMovie AND genre_link.media_type='movie' JOIN genre ON genre.genre_id=genre_link.genre_id WHERE genre.name like 'Horror'

and it works fine!!! It returns values with no errors.

Image

The problem is that somewhere along the way my SQL query is becoming messed up (it's the only way I can think to describe it)

In the first example it looks like this '..... genre_id=genre_link.`_?_id WHERE genre.name like 'Horror''

and in the second it looks like this '.... genre_id=genre_link._id WHERE genre.name like 'Horror'

There is either illegal characters or words missing.
Reply
#11
Yes, see my post above yours.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#12
Thank you Milhouse. I will be able to sleep tonight! It a great feeling knowing I've helped to identify a potential problem that can now be solved!

Smile
Reply

Logout Mark Read Team Forum Stats Members Help
JSONRPC Error: Invalid params.0