So some little background on what is occurring here. part of the script process to start the "clean up a room" tasks is to identify the room's eventual purpose. you can see this when it's working and you select a square room that can be used for anything, it asks you "bathroom? use this purpose", etc. The actual process of cleaning a room removes the stack parent of junk and places a stack parent of the room in the "before construction" phase. (i.e. the existing stack "semicircle office junked" is removed and replaced by "semicircle living quarters pre-construction" or whatever). i believe these are different and marked with a purpose in a way that is used by later steps.
the way i understand this works is exactly backwards of the way you expect it to. i.e. instead of figuring out how you want to use the room then offering you a list of options, the cleanup scans all the stacks that match that room template, figure out what "purposes" are fulfilled by the available stacks, and then presents the menu permitting you to choose the purpose of that room.
the room plan to be used by the finished room is layered on top of the pre-construction stack by the HQ constructions projects, which does the same calculation but from the other side to decide which settlement build menu options to show to the player.
the part that is failing here is that (for what ever reason) it can't find any stack parents that fit that room, so it can't figure out what purposes to offer you to contain parents matching the room you are cleaning up, so it fails the clean up task.
now as to why? i donno. maybe someone who understands more about how the stack parents are enumerated for those scripts can jump in here?
edit: added words for clairity