WGCNA Error- 'x' must be numeric.

Without a reprex—see the FAQ: How to do a minimal reproducible example reprex for beginners, I'm having to guess, but next try

traitData$Sample <- as.factor(traitData$Sample)
traitData$Treatment <- as.factor(traitData$Treatment)

Converting to factors will change the internal representation to numeric. Should work.