How to ensure saved state corresponds to correct plugin

Playing around with learning juce. I'm building a tool that can open a VST/AU, save its state to a file, and re-open it with the saved state. This is super easy to do using Juce (you guys are awesome!).

However, I'm wondering if there is a way to protect against using the wrong saved data file for a plugin.

For example, if I create a saved state file for PluginA (using AudioPluginInstance::getStateInformation()), and then try to open that file with some other plugin, say PluginB (using AudioPluginInstance::setStateInformation()), it produces unexpected behavior. Some VSTs just crash; others fail gracefully with an error log message and use defaults.

Is there a recommended way for me to ensure a particular saved state corresponds to the plugin I'm about to open -- or better yet, identify which plugin to open based on the data?