{"record":{"id":"895a7ccbec1496ee","repo":"puppetlabs/puppet","slug":"unable-to-extract-a-non-empty-literal-string-from","errorCode":null,"errorMessage":"Unable to extract a non-empty literal string from Struct member key type #{tc.string(key_type)}","messagePattern":"Unable to extract a non-empty literal string from Struct member key type #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/type_factory.rb","lineNumber":204,"sourceCode":"        key_type = optional(key_type) if tc.assignable?(value_type, PUndefType::DEFAULT)\n      else\n        # assert that the key type is one of String[1], NotUndef[String[1]] and Optional[String[1]]\n        case key_type\n        when PNotUndefType\n          # We can loose the NotUndef wrapper here since String[1] isn't optional anyway\n          key_type = key_type.type\n          s = key_type\n        when POptionalType\n          s = key_type.optional_type\n        when PStringType\n          s = key_type\n        when PEnumType\n          s = key_type.values.size == 1 ? PStringType.new(key_type.values[0]) : nil\n        else\n          raise ArgumentError, \"Illegal Struct member key type. Expected NotUndef, Optional, String, or Enum. Got: #{key_type.class.name}\"\n        end\n        unless s.is_a?(PStringType) && !s.value.nil?\n          raise ArgumentError, \"Unable to extract a non-empty literal string from Struct member key type #{tc.string(key_type)}\"\n        end\n      end\n      PStructElement.new(key_type, value_type)\n    end\n    PStructType.new(elements)\n  end\n\n  # Produces an `Object` type from the given _hash_ that represents the features of the object\n  #\n  # @param hash [{String=>Object}] the hash of feature groups\n  # @return [PObjectType] the created type\n  #\n  def self.object(hash = nil, loader = nil)\n    hash.nil? || hash.empty? ? PObjectType::DEFAULT : PObjectType.new(hash, loader)\n  end\n\n  def self.type_set(hash = nil)\n    hash.nil? || hash.empty? ? PTypeSetType::DEFAULT : PTypeSetType.new(hash)","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/type_factory.rb#L186-L222","documentation":"Error \"Unable to extract a non-empty literal string from Struct member key type #{tc.string(key_type)}\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/types/type_factory.rb:204 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}