Assume this config:
# config
a = 1
b = 2
c = "$a + $a = $b"
# spec
a = integer
b = integer
c = string
It finds that c matches with Template regex, tries to substitute a into c, finds a and tries to match Template regex with a that is integer because of spec applied. So, it raises TypeError: expected string or bytes-like object.