I'm looking at your traceback, and it complains about "vein_mat". It does indeed look like it's used incorrectly (i.e. that it's a bug).
However, then I try the script it doesn't trigger the error because it doesn't enter the loop where the error is, so I can't reproduce the error. I believe line 3950 should say "index = vein})", but I'd like to be able to reproduce the error so I can see if that actually does fix it.
There are two approaches I can see:
- You upload your save to DFFD and describe where your cursor is when the Biome Manipulator is started (so I can start it at the same location and reproduce the error).
- You change that line locally in your copy and report back. Note that you'd have to make sure you're testing this with the cursor in exactly the same place as the one(s) you get the error in, as the reason it hasn't been detected earlier is that most world tiles don't seem to fulfill the conditions.
As an aside, it seems to require the top layer (which should be soil in forests) should have veins, which doesn't happen in vanilla DF. I don't think it would happen in mountains either, as the top layer ought to be soil there as well, but eroded away so the top visible layer is rock.
This indicates there's something odd with your world, so if you haven't intentionally introduced veins into soil you ought to take a look at what changes there are (I'm not saying this doesn't mean there isn't a bug, only that special conditions that may not be intended are required for the bug to manifest itself).