Cannot set encoded on non-encoded capable object

That seems to be the main error but the full error message is
e[1mTracebacke[m (most recent call last):
4: from playground.rb:42:in `’
3: from playground.rb:42:in `p’
2: from playground.rb:42:in `inspect’
1: from playground.rb:42:in `inspect’
playground.rb:42:in `inspect’: e[1mcannot set encoding on non-encoding capable object (e[1;4mArgumentErrore[me[1m)e[m

Maybe it is because I need to combine the previous values of the types arrays with the additional values and not the previous values are set. What does the error mean and how to fix it?
`ptl=[[0,3],[1,5],[2],[3,14],[4,0],[5,0],[6,15],[7,9],[8,7],[9,11],[10,16],[11,6],[12],[13,9],[14],[15,14],[16]]
ptl.shuffle()
str=ptl[0]+ptl[1]+ptl[2]
cr=3
i=0
w=Array.new(2) { [] }
until i==3
p ptl[cr]
w[i]=ptl[cr]
if ((w[i]&str).length()==0)
i+=1
end
cr+=1

end
types=Array.new(19) { [[],[],[]] }

pwt=w[0]+w[1]+w[2]

types[17]=[[pwt],[str]]
for i in 0…(pwt.length()-1)
types[pwt[i]]=[[],[19]]
end
for i in 0…(str.length()-1)
types[str[i]]=[[19],[]]
end
typeslist=Array.new(17) {|i| i }
sampstr=Array.new(6) { [] }
sampwk=Array.new(6) { [] }
for i in 0…types.length()-1
typeslist.shuffle()
for j in 0…5
sampstr.push typeslist[j]
end
for j in 6…12
sampwk. push typeslist[j]
end
types[0][i]=sampstr.push types[0][i]
types[1][i]=sampwk.push types[1][i]
types[2][i]=typeslist[13]
end
p types`