{"record":{"id":"9eae0c7acf61e751","repo":"mongodb/mongoid","slug":"field-name-is-not-an-aliased-field","errorCode":null,"errorMessage":"Field #{name} is not an aliased field","messagePattern":"Field #(.+?) is not an aliased field","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/attributes.rb","lineNumber":335,"sourceCode":"        aliased_fields[name.to_s] = original.to_s\n\n        alias_method name, original\n        alias_method \"#{name}=\", \"#{original}=\"\n        alias_method \"#{name}?\", \"#{original}?\"\n        alias_method \"#{name}_change\", \"#{original}_change\"\n        alias_method \"#{name}_changed?\", \"#{original}_changed?\"\n        alias_method \"reset_#{name}!\", \"reset_#{original}!\"\n        alias_method \"reset_#{name}_to_default!\", \"reset_#{original}_to_default!\"\n        alias_method \"#{name}_was\", \"#{original}_was\"\n        alias_method \"#{name}_will_change!\", \"#{original}_will_change!\"\n        alias_method \"#{name}_before_type_cast\", \"#{original}_before_type_cast\"\n      end\n\n      # Removes a field alias.\n      #\n      # @param [ Symbol ] name The aliased field name to remove.\n      def unalias_attribute(name)\n        raise AttributeError, \"Field #{name} is not an aliased field\" unless aliased_fields.delete(name.to_s)\n\n        remove_method name\n        remove_method \"#{name}=\"\n        remove_method \"#{name}?\"\n        remove_method \"#{name}_change\"\n        remove_method \"#{name}_changed?\"\n        remove_method \"reset_#{name}!\"\n        remove_method \"reset_#{name}_to_default!\"\n        remove_method \"#{name}_was\"\n        remove_method \"#{name}_will_change!\"\n        remove_method \"#{name}_before_type_cast\"\n      end\n    end\n\n    def lookup_attribute_presence(name, value)\n      value = localized_fields[name].send(:lookup, value) if localized_fields.has_key?(name) && value\n      value.present?\n    end","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/attributes.rb#L317-L353","documentation":"Error \"Field #{name} is not an aliased field\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/attributes.rb:335 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":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}