Brain Workshop failure due to user profile name

I learned, the hard way, that there's a convention to Brain Workshop user profiles that must be adhered to, otherwise bad things happen.

Don't use hyphens in the profile name. If you do, then the next time you're in the app and type U to change profile, the app will ignore the command. Booooo, Brain Workshop!

I believe Brain Workshop sees a hyphen and thinks it's reached the end of the user-provided part of the names used to identify all configuration and data files for that profile.

For instance, in ~/Library/Application Support/Brain Workshop, if you've created custom profiles, you'll notice files with names ending in -config.ini, -stats.txt etc. The prefix of each file name is provided by the name you specify when creating the profile.

What made things more complicated was that when Brain Workshop failed, it did so silently, without any hint as to why. I only discovered what was going on when I started the app from command line. Fortunately, errors are logged to console. On Mac the command was:

/Applications/Brain\ Workshop.app/Contents/MacOS/brainworkshop

Which yielded this, when I typed U to choose a profile in Brain Workshop:

Traceback (most recent call last):  
  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
  File "pyglet/window/carbon/__init__.pyc", line 985, in _on_key_down
  File "pyglet/window/__init__.pyc", line 1219, in dispatch_event
  File "pyglet/event.pyc", line 340, in dispatch_event
  File "/Applications/Brain Workshop.app/Contents/Resources/brainworkshop.pyw", line 4282, in on_key_press
    UserScreen()
  File "/Applications/Brain Workshop.app/Contents/Resources/brainworkshop.pyw", line 1935, in __init__
    default=users.index(USER))
ValueError: list.index(x): x not in list  

To get context on the problem, I went looking in the source code for brainworkshop.pyw, located at /Applications/Brain Workshop.app/Contents/Resources/brainworkshop.pyw. Examining the code alerted me to the fact that the app was constructing file names from profile names. Then I noticed how I'd used a hyphen in the new profile name, but not any of the older ones.

I hope this post helps others, specifically when Brain Workshop fails due to a problematic profile name, but also generally when one needs to figure out why the app is behaving weird, and how to dig further into the problem.