birdcage.history doesn’t exist
That means you are passing nil to util.JSONToTable, when it’s supposed to take a string. Hopefully that’s already clear though.
Since you’re passing the value textdata to util.JSONToTable, that must be nil. Which means file.Read must have returned nil. I’m going to guess that’s what it does if the file doesn’t exist; does the file exist?