Weird .fbx export problem (with modified rigify [pitchipoy] rig)

As indicated in the title, I’ve run into a strange problem trying to export out a .fbx from an animated rig I’m working with.
Whenever I try to export out from the problematic file, I receive an error:

It’s a pitchipoy rig that I modified to add my own bones/controls, which I’m guessing could possibly be what’s the causing the problem, but I can’t figure out why.

I did find kind of a workaround though… After spending some many annoying hours, I figured out that if I scrap all the actions, reload the file so there are no actions, then append some of the exact same actions to the exact same rig, I’m able to export no problem.

In the above process though, even if I delete all actions but still have them in the file (with 0 users), I would be met with the error when trying to export.

And if I append all the actions, not just some, I’m met with an error as well.

Maybe there’s an interplay between the pitchipoy rig and the actions that’s problematic…?

Does anybody know what is wrong with the attached file?


ModifiedRigify_FBXexportProblem.blend (4.49 MB)

Just an update in case this helps anyone out in the future.

I opened a bug report of this problem. Nobody could figure out how the problem happened, but Bastien wrote up a script that resolved the problem for me. Run the following in the Python Console and it deletes the problematic f-curves, allowing .fbx export:

>>> for act in D.actions:
for fc in act.fcurves:
try: s = fc.data_path.encode()
except: act.fcurves.remove(fc)