How many factory buildings (of the type you're trying to mine) have you picked up? There's a hard limit of 90 factory buildings per size that you can save as an item at once. It's impressive and disturbing that you managed to run into this issue.
Anyway, you need to place some of your picked-up factory buildings down before you can pick up others again. If you can't find them in your logistics system, try using the factory requester chest. If you still can't find them, or if you actually destroyed them in item form, they still count up to the 90 building limit, but you can get them back (and place them down somewhere) by using the /give-lost-factory-buildings
command.