{"record":{"id":"d362cd66eed11dd0","repo":"SeleniumHQ/selenium","slug":"name-field-name-received-null-but-is-not-nul","errorCode":null,"errorMessage":"#{name}##{field.name} received null but is not nullable","messagePattern":"#(.+?)##(.+?) received null but is not nullable","errorType":"exception","errorClass":"Error::SerializationError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/bidi/serialization/record.rb","lineNumber":241,"sourceCode":"            end\n\n            # A required field absent from the response is tolerated as omitted (UNSET) and warned, so a\n            # schema ahead of the browser does not block the caller; strict mode (SE_BIDI_STRICT) escalates\n            # to an error for callers who want it. Omitted (UNSET) stays distinct from an explicit null (nil),\n            # which matters for the required-and-nullable fields the schema flags.\n            def missing_required(field)\n              message = \"#{name}##{field.name} is required but was missing from the response\"\n              raise Error::SerializationError, message if Serialization.strict?\n\n              WebDriver.logger.warn(message, id: :bidi_missing_required)\n              UNSET\n            end\n\n            def read(field, raw)\n              if raw.nil?\n                return raw if field.nullable\n\n                raise Error::SerializationError, \"#{name}##{field.name} received null but is not nullable\"\n              end\n              check_shape(field, raw)\n              return Serialization.to_symbol(\"#{name}##{field.name}\", raw, enum_hash(field)) if field.enum\n\n              if field.ref.nil?\n                check_primitive(field, raw) unless field.list\n                return raw\n              end\n\n              read_ref(field, raw)\n            end\n\n            # Reads a ref-typed value into its class. A `scalar` position is an inline union with\n            # a scalar arm collapsed onto its union ref (a map's string keys): a non-object leaf\n            # passes through instead of being handed to the object_only union, but only when it\n            # matches the arm's primitive (+scalar+ carries it). A list recurses per element.\n            def read_ref(field, raw)\n              klass = (@refs ||= {})[field.name] ||= Protocol.const_get(field.ref)","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/bidi/serialization/record.rb#L223-L259","documentation":"During BiDi Record deserialization, read() sees an explicit null (raw.nil?) for a field the schema does not mark nullable, and raises Error::SerializationError. Unlike a missing field, an explicit JSON null at a non-nullable position is a hard wire error in both lenient and strict modes.","triggerScenarios":"The browser/grid sends JSON null at a BiDi field declared non-nullable by the schema. Reached on inbound from_json for any Record field that is not flagged nullable.","commonSituations":"Browser returns null where the spec requires a value, server bug, version skew, proxy rewriting a value to null, nullable flag mis-generated in the schema.","solutions":["Capture the raw BiDi response to confirm which field arrived null.","Verify the field is genuinely required/non-nullable in the W3C BiDi spec for your browser version.","Align Selenium and browser/driver versions.","File a bug against the browser or Selenium with the payload if the spec disagrees with the behavior."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Before trusting a BiDi value, coerce/validate non-nullability at the call site.\ndef non_null!(value, field)\n  raise \"#{field} must not be null\" if value.nil?\n  value\nend","typeGuard":"def present?(value)\n  !value.nil?\nend","tryCatchPattern":"begin\n  record = SomeRecord.from_json(payload)\nrescue Selenium::WebDriver::Error::SerializationError => e\n  raise unless e.message =~ /received null but is not nullable/\n  warn \"non-nullable field arrived null: #{e.message}\"\nend","preventionTips":["Capture raw payloads to identify which non-nullable field arrived null.","Align Selenium and browser versions when nullable semantics change.","Treat null-at-non-nullable as a server/browser bug, not a recoverable input."],"tags":["bidi","serialization","nullable","schema","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}