Encoding::ConverterNotFoundError
RubyERRORCriticalEncoding
No converter available between encodings
Quick Answer
Verify the encoding name is correct and supported; use Encoding.list to see available encodings.
What this means
Raised when Ruby cannot find a converter to transcode between two specified encodings. This can happen with obscure or non-standard encoding names.
Why it happens
- 1Specifying a misspelled or non-existent encoding name
- 2Attempting conversion between two encodings with no direct or indirect path
Fix
List available encodings and correct the name
List available encodings and correct the name
Encoding.list.map(&:name).sort.grep(/UTF/)
# Find the exact encoding name, then use it:
str.encode('UTF-8')Why this works
Encoding.list returns all encodings Ruby knows about, helping you find the correct name.
Code examples
Reproducing the errorruby
'hello'.encode('FAKE-ENCODING')
# Encoding::ConverterNotFoundError: code converter not found (FAKE-ENCODING)List available encodingsruby
Encoding.list.first(5).map(&:name) # => ["ASCII-8BIT", "UTF-8", "US-ASCII", "UTF-16BE", ...]
Rescue itruby
begin
str.encode(requested_encoding)
rescue Encoding::ConverterNotFoundError
str.encode('UTF-8') # fallback
endSame error in other languages
Sources
Official documentation ↗
Ruby Core Documentation
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev