The error is coming from the peripheral's code - the author is failing to handle a problem correctly. I'd guess that problem is you trying to get an item that isn't in the system. Dunno.
There are a number of ways to deal with the multiword item name thing.
Maybe the simplest one is to switch to a "get <amount> <item>" format, where <amount> is optional and <item> is taken to be all remaining words in the message.
First we need to determine if the second word of the message is a number or not. Then we concatenate whatever's left:
if words[1] == "get" then
local amount = tonumber( words[2] ) -- Either returns a number, or if words[2] doesn't represent one, nil.
local item
if amount then -- If amount is non-nil, then...
item = table.concat( words, " ", 3 )
else -- If words[2] didn't represent a number, then...
item = table.concat( words, " ", 2 )
amount = 1
end
item = translate[ item:lower() ] or item
bridge.retrieve(item, amount, "east")
end
So you might issue a command like "get stone", or "get 10 dirt", or "get 4 sticky piston".
See here regarding table.concat().