{"record":{"id":"03274f010f056897","repo":"puppetlabs/puppet","slug":"type-type-is-not-supported","errorCode":null,"errorMessage":"Type %{type} is not supported.","messagePattern":"Type %(.+?) is not supported\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/windows/registry.rb","lineNumber":257,"sourceCode":"        # buffer is raw bytes, *not* chars - less a NULL terminator\n        string_length = (byte_length / WCHAR_SIZE) - 1 if byte_length > 0\n\n        begin\n          result = case type\n                   when Win32::Registry::REG_SZ, Win32::Registry::REG_EXPAND_SZ\n                     [type, data_ptr.read_wide_string(string_length, Encoding::UTF_8, true)]\n                   when Win32::Registry::REG_MULTI_SZ\n                     [type, data_ptr.read_wide_string(string_length).split(/\\0/)]\n                   when Win32::Registry::REG_BINARY\n                     [type, data_ptr.read_bytes(byte_length)]\n                   when Win32::Registry::REG_DWORD\n                     [type, data_ptr.read_dword]\n                   when Win32::Registry::REG_DWORD_BIG_ENDIAN\n                     [type, data_ptr.order(:big).read_dword]\n                   when Win32::Registry::REG_QWORD\n                     [type, data_ptr.read_qword]\n                   else\n                     raise TypeError, _(\"Type %{type} is not supported.\") % { type: type }\n                   end\n        rescue IndexError => ex\n          raise if ex.message !~ /^Memory access .* is out of bounds$/i\n\n          parent_key_name = key.parent ? \"#{key.parent.keyname}\\\\\" : \"\"\n          Puppet.warning _(\"A value in the registry key %{parent_key_name}%{key} is corrupt or invalid\") % { parent_key_name: parent_key_name, key: key.keyname }\n        end\n      end\n\n      result\n    end\n\n    def query_value_ex(key, name_ptr, &block)\n      FFI::MemoryPointer.new(:dword) do |type_ptr|\n        FFI::MemoryPointer.new(:dword) do |length_ptr|\n          result = RegQueryValueExW(key.hkey, name_ptr,\n                                    FFI::Pointer::NULL, type_ptr,\n                                    FFI::Pointer::NULL, length_ptr)","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/windows/registry.rb#L239-L275","documentation":"Raised in the else arm of Registry.read's decoding case (lib/puppet/util/windows/registry.rb:257): the value's registry type exists but Puppet has no reader for it. Supported types are REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_BINARY, REG_DWORD, REG_DWORD_BIG_ENDIAN and REG_QWORD; anything else — REG_NONE, REG_RESOURCE_LIST, REG_FULL_RESOURCE_DESCRIPTOR, REG_RESOURCE_REQUIREMENTS_LIST, REG_LINK — raises TypeError.","triggerScenarios":"Enumerating a key and reading every value when it contains hardware/resource descriptions (REG_RESOURCE_LIST under HKLM\\HARDWARE\\RESOURCEMAP); values explicitly created as REG_NONE by installers or drivers; REG_LINK values in schema hives.","commonSituations":"Generic registry-walk code (inventory, drift detection) that assumes every value decodes; drivers storing opaque blobs; tools writing REG_NONE markers.","solutions":["Filter values by type before reading — probe the type via query_value_ex / RegQueryValueExW and skip the unsupported set.","Catch TypeError specifically during enumeration and warn-and-skip.","If the raw bytes are genuinely needed, read them through query_value_ex instead of read.","Rewrite values you own into a supported type (reg.exe add /t REG_BINARY /f)."],"exampleFix":"# before — read every value, dies on REG_RESOURCE_LIST\ntype, data = read(key, name)\n\n# after — skip values Puppet cannot decode\nbegin\n  type, data = read(key, name)\nrescue TypeError\n  Puppet.debug \"skipping unreadable value #{name}\"\n  nil\nend","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"SUPPORTED = [Win32::Registry::REG_SZ, Win32::Registry::REG_EXPAND_SZ, Win32::Registry::REG_MULTI_SZ,\n             Win32::Registry::REG_BINARY, Win32::Registry::REG_DWORD, Win32::Registry::REG_DWORD_BIG_ENDIAN,\n             Win32::Registry::REG_QWORD]\ntype = nil\nRegistry.query_value_ex(key, name) { |t, _ptr, _len| type = t }\nreadable = SUPPORTED.include?(type)","tryCatchPattern":"begin\n  type, data = read(key, name)\nrescue TypeError => e\n  Puppet.debug \"#{e.message} — skipping #{name}\"\n  next\nend","preventionTips":["Type-filter before read when walking arbitrary keys","Keep a documented allow-list of supported registry types","Treat hardware and schema hives as opaque — inventory names and types only"],"tags":["windows","registry","unsupported-type","typeerror","puppet"],"backgroundTag":"registry-value-type-unsupported","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}