in https://raw.githubusercontent.com/screeps/engine/c318a920e3c04c1285c885e328d89ef748d7004c/src/game/creeps.js line 608 I think
if(data(target.id)[resourceType] || data(target.id)[resourceType] < amount) {
return C.ERR_NOT_ENOUGH_RESOURCES;
}
should read
if(!data(target.id)[resourceType] || data(target.id)[resourceType] < amount) {
return C.ERR_NOT_ENOUGH_RESOURCES;
}