PDA

View Full Version : Runtime error



Callum
April 16th, 2018, 21:31
I'm currently running a game, and FG has suddenly started throwing the following error into the console window:

Runtime Error: Unable to save file (C:/Users/Han/AppData/Roaming/Fantasy Grounds/campaigns/Rise of the Runelords/db.xml) - Error (22): Invalid argument
Runtime Error: Unable to save file (C:/Users/Han/AppData/Roaming/Fantasy Grounds/campaigns/Rise of the Runelords/moduledb/Burnt Offerings.xml) - Error (22): Invalid argument
Runtime Error: Unable to save file (C:/Users/Han/AppData/Roaming/Fantasy Grounds/campaigns/Rise of the Runelords/moduledb/Rise of the Runelords Chapter 3 The Hook Mountain Massacre.xml) - Error (22): Invalid argument
Runtime Error: Unable to save file (C:/Users/Han/AppData/Roaming/Fantasy Grounds/campaigns/Rise of the Runelords/moduledb/The Skinsaw Murders.xml) - Error (22): Invalid argument
Database Notice: Campaign saved.

I've never seen this error before, and I've no idea what could be causing it. Can anyone offer any suggestions? If I shut down FG after my game, will I lose data?

Zacchaeus
April 16th, 2018, 21:46
Does this happen in a new campaign? Do you have full read/write permissions to the folder you are saving to? Are you using any extensions? Usually unable to save suggests a file permissions issue, but you are saving to the default folder so that really shouldn't be an issue.

Callum
April 16th, 2018, 21:50
It's a long-term game, and I've never had any problems with it before on this same PC. In fact, I don't think it was even happening at the start of this session! I'm in the middle of a game, so I can't run tests right now. I'm only using the DoE sound extension.

What does "Invalid argument" mean?

Okay, my session has finished now, so I can look into it more. The FG application data folder shows that the db.xml file hasn't been updated since 20:37 this evening, but the chatlog.html file has been updated much more recently (22.22). 20.37 is over an hour into the session, so the problem started during the session - it would have auto-saved without fuss beforehand. The fact that it can write to the chatlog suggests that it's not a permissions issue (along with the fact that it was working fine before). So, what's the "invalid argument" that FG is passing when trying to write to the xml files that isn't present when writing to the chatlog?

So now I've shut down FG, re-started it, and opened that campaign again - and it has lost all the changes since 20.37. It still won't save, and throws the same error - but it only happens in that one campaign. It gives the "backup database" message when starting the campaign, but refers to a backup made the previous time we played the game.

Trenloe
April 16th, 2018, 22:58
When this error has happened to people before, it is because FG can't save the files.

How much free space do you have on your C drive?
Run an error check scan on the drive to see if there are any issues.
If you haven't closed down FG yes, type /save in the chat window and see if the errors are still there.

Callum
April 17th, 2018, 20:25
There's over 70 GB free on the C drive. Would it really give an "Invalid argument" error if it was a space or permissions issue? I guess it wouldn't be the first time in history that a piece of software has given an unhelpful error message...

There are no errors on the C drive.

I tried typing /save while FG was still running, and it gave the same errors. It did the same thing once I'd restarted FG.

Trenloe
April 17th, 2018, 20:38
Would it really give an "Invalid argument" error if it was a space or permissions issue?
It all depends on what error messages the file handling library passes back for this issue.


I tried typing /save while FG was still running, and it gave the same errors. It did the same thing once I'd restarted FG.
In other cases when there were permission issues FG raised "Error (13): Permission denied". So it probably isn't "normal" permission issues, but might be a less common permission issue.

The couple of times this has been mentioned in the past, is where basically the filename wasn't valid (maybe the filename is the invalid argument?).

- I'd go through and check all of those paths are valid, there is full access to all of those files for the Windows user you're logged in as.
- Copy the campaign with a different directory name, load the copied campaign up in FG and see if that raises the error.

Moon Wizard
April 17th, 2018, 20:47
From my research of past issues, I found what Trenloe wrote. It’s usually been tied to an “invalid” file name.

Make sure there are no trailing spaces or special characters in your campaign name.

Also, you can try in a brand new campaign. Create a new campaign with different name, exit, copy over contents of original campaign folder into new campaign folder, restart new campaign.

Regards,
JPG

Callum
April 18th, 2018, 21:18
The filename (or some part of the path) being faulty does seem like it would cause this error - but the path is fine, and there aren't any special characters anywhere in it. It also would have had to have changed while I was running my game, since it was working fine at the beginning oif the session.

I tried your suggestion of copying everything into a new campaign folder, and it worked fine in there. I also tried renaming the db.xml file in the original campaign folder, and replacing it with the most recent backup file, and that worked fine. Then - and here's the killer - I renamed the original db.xml file back to db.xml, and now it works fine!

I think I'll just have to write this off as one of those weird glitches that I'll never get to the bottom of, and set about trying to get the campaign back to where it should be with the help of the chatlog. Thanks for all your help, guys!