Got a runtime error moving a person to nothing

I have this right now

Every turn during Warehouse Investigation: If the player is in the location of the guard: Clear the screen; Say "You decide to investigate the strange footsteps - A mistake, it seems, as a guard catches sight of you."; Now the player is caught; Otherwise: Let X be the location of the guard; Let Y be a random room adjacent to X in the Warehouse; Move the guard to Y; If the location is adjacent to the location of the guard: Let way be the best route from location to the location of the guard; Say "You hear footsteps coming from [way]."; If the location is the location of the guard: Say "Your stomache drops as a guard walks in."; Now the player is caught.

Which has been working fine until just now, where I got:
[** Programming error: tried to “move” guard to nothing **]

Showing the guard shows that he’s somehow entered the parking lot - which is not a room in the warehouse - which seems to be the problem, he’s stuck there now. Anyone have a clue as to what caused that?

The compiler is getting confused by the multiple phrases in the line “…a random room adjacent to X in the Warehouse”. (I assume the Warehouse is a region?)

This should do what you want:

Definition: a room is warehousey if it is in the Warehouse.

	[...]
	let X be the location of the guard;
	let Y be a random warehousey room adjacent to X;
	if Y is nothing:
		say "(BUG) Guard got stuck in [X].";
	else:
		now the guard is in Y.

The compiler can deal with any number of adjectives strung together; it’s prepositional phrases that can go wrong.

Aye, Warehouse is a region, and thanks for the input.