Terraspace up <layer> crashes with error Exception ArgumentError: invalid byte sequence in UTF-8

Hi

On running
terraspace up

The log shows a crash with the following exception:
error Exception ArgumentError: invalid byte sequence in UTF-8

Is there anyway to get any debug from terraspace on this?
I can run terraform apply from the .terraspace-cache folder without issue and terraspace plan seems to work without issue.

Full exception stack below:

[2023-02-10T12:28:41 #4137 terraspace up compute]: Exception ArgumentError: invalid byte sequence in UTF-8
[2023-02-10T12:28:41 #4137 terraspace up compute]: /var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/logger.rb:17:in `format_message'
/usr/lib/ruby/3.0.0/logger.rb:476:in `add'
/usr/lib/ruby/3.0.0/logger.rb:529:in `info'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:99:in `handle_stdout'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:67:in `block (3 levels) in handle_streams'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:65:in `each'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:65:in `block (2 levels) in handle_streams'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:60:in `each'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:60:in `block in handle_streams'
/usr/lib/ruby/3.0.0/timeout.rb:97:in `block in timeout'
/usr/lib/ruby/3.0.0/timeout.rb:35:in `block in catch'
/usr/lib/ruby/3.0.0/timeout.rb:35:in `catch'
/usr/lib/ruby/3.0.0/timeout.rb:35:in `catch'
/usr/lib/ruby/3.0.0/timeout.rb:112:in `timeout'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:53:in `handle_streams'
/var/lib/gems/3.0.0/gems/terraspace-2.2.3/lib/terraspace/shell.rb:42:in `block in popen3'
/usr/lib/ruby/3.0.0/open3.rb:227:in `popen_run'

Regards
Martyn

Wondering if can get an example repo that reproduces this. Thanks.

I’ve seen this error on Terraform plan sometimes.

I’ve traced it to what appear to be unprintable/non-UTF-8 characters appearing in terraform output. You might like to try passing in terraforms -no-color option which may help.

If the --no-color option helps. Wondering if this should be an default setting in a future terraspace release. :face_with_monocle: Just thinking about. Thanks for the report.