Okay, so, I did some digging on this, and I figured out what was going on: JSON-RPC is choking on the backslashes in the file path. Stuck a web-pdb trace at the start of getFileDetails on line 104, and even though the path parameter has the slashes escaped properly, by the time they go through the JSON-RPC parser they're no longer escaped. Per the log I pasted in the message above, the JSON being passed is invalid:
json:
{"jsonrpc":"2.0","method":"Files.GetFileDetails","params":{"file":"D:\Kodi Wallpapers\Aquarium004-720p.mp4","media":"video","properties":["file"]},"id":1}
If you drop that into jsonlint, it'll choke on the "file" line because it thinks the backslashes are trying to escape something, when they aren't.
For my particular use case - that is, a flat link to a file on the filesystem, not in a playlist or in a media source, I fixed this by making the following change:
Before:
python:
json_query = ('{"jsonrpc":"2.0","method":"Files.GetFileDetails","params":{"file":"%s","media":"video","properties":["file"]},"id":1}' % (path))
After:
python:
json_query = ('{"jsonrpc":"2.0","method":"Files.GetFileDetails","params":{"file":"%s","media":"video","properties":["file"]},"id":1}' % (path.replace(os.sep, '/'))
I'd make a PR against the repository but this is the first I've ever done any Kodi development and I don't know if this change would break links to media in a media source. Suffice it to say though that this definitively fixes the problem for me, and hopefully provides some insight into what exactly the bug here is.