New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid byte sequence in US-ASCII #1570

Closed
manuelmeurer opened this Issue Dec 1, 2011 · 8 comments

Comments

Projects
None yet
3 participants
@manuelmeurer

Getting the following error during deploy with Capistrano:

Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!

/usr/local/lib/ruby/1.9.1/rubygems/specification.rb:519:in `normalize_yaml_input'
:
invalid byte sequence in US-ASCII
(
ArgumentError
)
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:479:in `from_yaml'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:183:in `load_gemspec'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:51:in `block in initialize'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:32:in `initialize'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `new'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `open'
from /usr/local/lib/ruby/1.9.1/rubygems/package.rb:58:in `open'
from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:63:in `from_io'
from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:51:in `block in from_file_by_path'
from /usr/local/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /usr/local/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:50:in `from_file_by_path'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:100:in `spec_from_gem'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:209:in `block in cached_specs'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:205:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:205:in `cached_specs'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:165:in `fetch_specs'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:70:in `specs'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/lazy_specification.rb:48:in `__materialize__'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/spec_set.rb:86:in `block in materialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/spec_set.rb:83:in `map!'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/spec_set.rb:83:in `materialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/definition.rb:90:in `specs'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/definition.rb:78:in `resolve_with_cache!'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:47:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:12:in `install'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/cli.rb:219:in `install'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/base.rb:386:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.rc/bin/bundle:13:in `<top (required)>'
from /usr/local/bin/bundle:19:in `load'
from /usr/local/bin/bundle:19:in `<main>'

Gemfile and Gemfile.lock here: https://gist.github.com/1415877

Bundler version: 1.1.rc
Ruby version: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Rails version: 3.1.3

@indirect

This comment has been minimized.

Show comment
Hide comment
@indirect

indirect Dec 1, 2011

Member

Your server's encoding is set to ASCII, and you are trying to load a gemspec that contains UTF-8. Ruby is (correctly) informing you that this is impossible.

Member

indirect commented Dec 1, 2011

Your server's encoding is set to ASCII, and you are trying to load a gemspec that contains UTF-8. Ruby is (correctly) informing you that this is impossible.

@indirect indirect closed this Dec 1, 2011

@manuelmeurer

This comment has been minimized.

Show comment
Hide comment
@manuelmeurer

manuelmeurer Dec 1, 2011

I didn't change/set my server's encoding.
How would I do that?

Deploy always worked fine in the past.
Are you sure it's not an issue with Bundler or the gemspec of one of the gems?

I didn't change/set my server's encoding.
How would I do that?

Deploy always worked fine in the past.
Are you sure it's not an issue with Bundler or the gemspec of one of the gems?

@indirect

This comment has been minimized.

Show comment
Hide comment
@indirect

indirect Dec 1, 2011

Member

Most linux distributions default to ASCII. You will have to look at the documentation for your operating system to find out how to set the encoding, it's usually an environment variable like LANG.

Deploys in the past obviously didn't try to load UTF-8 characters while Ruby's encoding was set to ASCII.
Yes, I am sure it's not an issue with Bundler. I am explicitly telling you it is an issue with one of your gemspecs: there is UTF-8 in your gemspecs, and your OS is telling Ruby to only accept ASCII. That's why Ruby is raising an exception.

Member

indirect commented Dec 1, 2011

Most linux distributions default to ASCII. You will have to look at the documentation for your operating system to find out how to set the encoding, it's usually an environment variable like LANG.

Deploys in the past obviously didn't try to load UTF-8 characters while Ruby's encoding was set to ASCII.
Yes, I am sure it's not an issue with Bundler. I am explicitly telling you it is an issue with one of your gemspecs: there is UTF-8 in your gemspecs, and your OS is telling Ruby to only accept ASCII. That's why Ruby is raising an exception.

@manuelmeurer

This comment has been minimized.

Show comment
Hide comment
@manuelmeurer

manuelmeurer Dec 1, 2011

You are not being very helpful.
The exception states I should report it here but you shut it down immediately without trying to help me to find the cause.

Deploys in the past obviously didn't try to load UTF-8 characters while Ruby's encoding was set to ASCII.

Why not? What do you mean by "in the past"? I meant Bunder < 1.1.rc, so if this error occurs after updating to 1.1.rc, I think it's fair to assume it may have something to do with the upgrade.

Yes, I am sure it's not an issue with Bundler. I am explicitly telling you it is an issue with one of your gemspecs: there is UTF-8 in your gemspecs, and your OS is telling Ruby to only accept ASCII. That's why Ruby is raising an exception.

Yes, I hear what you are explicitly telling me and I don't doubt that you are right.
I just would like to resolve this issue so a little hint pointing me in the right direction would be nice.
Should I check the gemspecs of all the gems I added since the last deploy?

You are not being very helpful.
The exception states I should report it here but you shut it down immediately without trying to help me to find the cause.

Deploys in the past obviously didn't try to load UTF-8 characters while Ruby's encoding was set to ASCII.

Why not? What do you mean by "in the past"? I meant Bunder < 1.1.rc, so if this error occurs after updating to 1.1.rc, I think it's fair to assume it may have something to do with the upgrade.

Yes, I am sure it's not an issue with Bundler. I am explicitly telling you it is an issue with one of your gemspecs: there is UTF-8 in your gemspecs, and your OS is telling Ruby to only accept ASCII. That's why Ruby is raising an exception.

Yes, I hear what you are explicitly telling me and I don't doubt that you are right.
I just would like to resolve this issue so a little hint pointing me in the right direction would be nice.
Should I check the gemspecs of all the gems I added since the last deploy?

@indirect

This comment has been minimized.

Show comment
Hide comment
@indirect

indirect Dec 1, 2011

Member

That error message was added with the best of intentions, but is completely wrong in this case.

The backtrace you pasted clearly shows the exception is coming from inside Rubygems. The Rubygems ticket explains that the exception that you pasted is a bug in Rubygems. That means the Bundler upgrade didn't cause the exception.

I'm not trying to be rude, I simply don't have time to provide free debugging and troubleshooting support for other people's projects. I would much rather spend the very small amount of open source time I have fixing bugs in Bundler.

I thought you might simply google "normalize_yaml_input invalid byte sequence in US-ASCII" and find the Rubygems bug report that explains the problem and mentions that the fix is to set the locale in your environment, possibly like this:

LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
Member

indirect commented Dec 1, 2011

That error message was added with the best of intentions, but is completely wrong in this case.

The backtrace you pasted clearly shows the exception is coming from inside Rubygems. The Rubygems ticket explains that the exception that you pasted is a bug in Rubygems. That means the Bundler upgrade didn't cause the exception.

I'm not trying to be rude, I simply don't have time to provide free debugging and troubleshooting support for other people's projects. I would much rather spend the very small amount of open source time I have fixing bugs in Bundler.

I thought you might simply google "normalize_yaml_input invalid byte sequence in US-ASCII" and find the Rubygems bug report that explains the problem and mentions that the fix is to set the locale in your environment, possibly like this:

LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
@manuelmeurer

This comment has been minimized.

Show comment
Hide comment
@manuelmeurer

manuelmeurer Dec 1, 2011

Thanks, I will try that!

Thanks, I will try that!

@seekshiva

This comment has been minimized.

Show comment
Hide comment
@seekshiva

seekshiva Aug 29, 2014

I exported the variables like you said, but that doesn't change anything:

$ export LANG="en_US.UTF-8"
$ export LC_ALL="en_US.UTF-8"
$ vagrant ssh
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222:in `split': invalid byte sequence in UTF-8 (ArgumentError)
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222:in `setup_environment'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:15:in `setup'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler.rb:127:in `setup'
    from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:71:in `<main>'

I exported the variables like you said, but that doesn't change anything:

$ export LANG="en_US.UTF-8"
$ export LC_ALL="en_US.UTF-8"
$ vagrant ssh
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222:in `split': invalid byte sequence in UTF-8 (ArgumentError)
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222:in `setup_environment'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:15:in `setup'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler.rb:127:in `setup'
    from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:71:in `<main>'
@seekshiva

This comment has been minimized.

Show comment
Hide comment
@seekshiva

seekshiva Aug 29, 2014

this happens randomly in few terminal sessions.. if I close and reopen the Terminal app, it works fine

This is on Yosemite beta. I'm using the system ruby, and its bundler.

this happens randomly in few terminal sessions.. if I close and reopen the Terminal app, it works fine

This is on Yosemite beta. I'm using the system ruby, and its bundler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment