{"id":1839,"date":"2026-11-17T09:41:42","date_gmt":"2026-11-17T09:41:42","guid":{"rendered":"https:\/\/ruby-doc.org\/learn\/?p=1839"},"modified":"2026-11-17T09:41:43","modified_gmt":"2026-11-17T09:41:43","slug":"ruby-missing-keyword-argument","status":"publish","type":"post","link":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/","title":{"rendered":"Ruby Missing Keyword Argument: Find and Fix the Missing Name"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A Ruby missing keyword argument error means a method wants a named argument that the call did not give. Compare the missing name in the error to the method definition. Pass it explicitly as a keyword, or fix the hash or wrapper providing it. The exception is ArgumentError. A required keyword supplied with nil is present, though its value may be invalid for your application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Go back to the first applicable application frame in the backtrace. See which receiving method you use, the actual argument keys you are sending, and any code forwarding between them. While you could add a default for a required key, this should only happen when omission of the key has some meaning. Otherwise, a default will cover up where the problem really was &#8212; missing input.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1600\" height=\"1000\" src=\"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp\" alt=\"Ruby missing keyword argument comparison showing an absent name, a supplied nil value and a valid supplied name\" class=\"wp-image-1838\" srcset=\"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp 1600w, https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence-300x188.webp 300w, https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence-1024x640.webp 1024w, https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence-768x480.webp 768w, https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence-1536x960.webp 1536w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><figcaption class=\"wp-element-caption\">A required keyword verifies that a name was sent. Check its value separately, and add a default only when omission is intended.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Read a Ruby missing keyword argument error<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In Ruby, how you declare a method parameter makes a difference. When you follow a name with a colon and do not include a default value, you are declaring a required keyword. The caller must send the name. An identically-named local variable does not inherently meet the requirements, nor does sending an unrelated positional value. Take a look at the call syntax as well as the data being passed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def greet(name:)\n  \"Hello, #{name}\"\nend\n\nbegin\n  greet\nrescue ArgumentError =&gt; error\n  puts error.message.lines.first.strip\nend\nputs greet(name: \"Mina\")\n# missing keyword: :name\n# Hello, Mina<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this case, the method will not begin its normal processing until the caller supplies the required keyword. Before you make any changes, take a look at the exception&#8217;s name and first message line. If the message says that the keyword was unknown, the caller sent a name that the signature does not allow. If it says there is a positional count mismatch, first see which positional arguments the caller sent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While debugging these cases separately, remember that a typo can cause a missing-name complaint because it prevented the intended name from reaching the method. However, adding all possible spellings to the method signature makes it harder to understand what your public API provides. Change the caller to use the agreed upon name, and save a regression test for that call.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Required, optional and present with nil<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A required keyword answers \u201cwas the name supplied?\u201d, not \u201cis the value valid?\u201d. It promises nothing about whether the supplied value is nonempty, a string or useful. This is why replacing a missing keyword with nil may prevent the original exception but cause another failure inside the method.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def required_value(name:)\n  name\nend\n\ndef optional_value(name: \"Guest\")\n  name\nend\n\np required_value(name: nil)\np optional_value\np optional_value(name: nil)\n# nil\n# \"Guest\"\n# nil<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The default for an optional keyword gets used when the caller omits the name. It does not get used when there is an explicitly-supplied nil value. So, determine for yourself if absence (not giving) and nil should be equivalent things in your application. If they represent something different, preserve that difference at the interface level instead of turning everything into a generic fallback.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Input situation<\/th><th>Required keyword<\/th><th>Keyword with a default<\/th><\/tr><\/thead><tbody><tr><td>Name omitted<\/td><td>Raises a missing-keyword error<\/td><td>Uses its default<\/td><\/tr><tr><td>Name supplied with nil<\/td><td>Accepts the keyword\u2019s presence<\/td><td>Uses the supplied nil<\/td><\/tr><tr><td>Name supplied with a value<\/td><td>Receives that value<\/td><td>Receives that value<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For example, creating a default customer identifier would mislead users. Creating a documented fallback for an optional display label might be reasonable. The syntax cannot decide this product decision for you. Decide what contract you want first, then use required keywords, defaults and explicit value verification to enforce it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Inspect the receiving method\u2019s parameters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Do not assume that the method open in your editor is the one getting called. A subclass can override it, a module can provide it, and a wrapper can forward calls to another object. Examine the bound method on the actual receiver. The parameter metadata on that bound method distinguishes between required keywords, optional keywords and a keyword-rest parameter.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Delivery\n  def label(name:, copies: 1, **extras)\n    [name, copies, extras]\n  end\nend\n\np Delivery.new.method(:label).parameters\n# [[:keyreq, :name], [:key, :copies], [:keyrest, :extras]]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The keyword-rest parameter gathers additional keywords but does not provide a missing required name. Adding it just to stifle complaints changes the accepted input. Use it if the method intentionally supports an open set of options, and retain explicit parameters for inputs with a defined purpose.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If method definitions and hashes are still foreign territory, the <a href=\"https:\/\/ruby-doc.org\/learn\/ruby-programming-language-overview\/\">Ruby programming language overview<\/a> takes those concepts through a complete program. For this error, focus on finding the receiving method\u2019s exact signature and comparing it with the names supplied by the failing call.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fix a Ruby missing keyword argument from a hash<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">first examine each of the hash keys. Strings are not symbols even when their displayed characters appear to be identical. Input parsed from an external source (parser, etc.) may deliver strings whereas a named Ruby keyword parameter expects its matching symbol name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def address(city:, **extras)\n  [city, extras]\nend\n\npayload = { \"city\" =&gt; \"Leeds\" }\nbegin\n  address(**payload)\nrescue ArgumentError =&gt; error\n  puts error.message.lines.first.strip\nend\np address(city: payload.fetch(\"city\"))\n# missing keyword: :city\n# [\"Leeds\", {}]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Notice in this example how the keyword-rest parameter makes the distinction visible: although the rest parameter is able to accept additional keys, it is not able to satisfy the required &#8220;city&#8221; keyword. The corrected call explicitly maps the known input field and also utilizes a lookup that raises an exception if that field is missing so that an missing source field is not silently replaced with nil.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is generally easier to map only selected fields as opposed to transforming all keys and forwarding the entire payload. Mapping selected fields provides documentation on which inputs this method will use. It gives you a place to validate values and reject unexpected input according to your application\u2019s needs. Do not treat unrestricted keyword forwarding as a substitute for input validation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Preserve keywords through wrappers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A direct call may work but fail under the same conditions using the same call through a wrapper. Examine what the wrapper received and what the wrapper sent. Only sending positional arguments can change the shape of a keyword call. For transparent delegates Ruby\u2019s shorthand preserves both positional arguments and keywords and the block together.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def destination(city:)\n  block_given? ? yield(city) : city\nend\n\ndef relay(...)\n  destination(...)\nend\n\nputs relay(city: \"Leeds\") { |city| city.upcase }\n# LEEDS<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/rubystyle.guide\/#arguments-forwarding\">Ruby Style Guide\u2019s argument-forwarding guidance<\/a> recommends this shorthand for suitable delegates. However, forwarding the block is also a behavioral choice. Keep an explicit signature when a wrapper needs to filter, validate or transform inputs. Test the wrapper itself: a successful direct-call test does not establish proper forwarding.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When an upgrade reveals the error compare the installed dependency\u2019s signature to the documentation for that version. Try not to simply copy a call from an older tutorial without checking assumptions. Even though a changed required keyword requires intentional caller update(s) you shouldn\u2019t add a blanket rescue around every operation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Try the missing-keyword exercise<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Which call below fails: the one providing nil or the one providing no name? Make your prediction prior to opening up the answer. Since the method returns the input without validating it this isolates the issue at hand &#8212; keyword presence. We\u2019re not determining whether nil would be appropriate in your real application here.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def recipient(name:)\n  name\nend\n\np recipient(name: nil)\nbegin\n  recipient\nrescue ArgumentError =&gt; error\n  puts error.message.lines.first.strip\nend<\/code><\/pre>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>Reveal the output and the reason<\/summary>\n\n<pre class=\"wp-block-code\"><code>nil\nmissing keyword: :name<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The first call supplies the required name and returns nil. The second omits the name and raises before the body runs. If the application needs a nonempty string, add value validation separately. Adding a default changes the presence contract; it does not validate the value.<\/p>\n\n<\/details>\n\n\n\n<h2 class=\"wp-block-heading\">Test the Ruby missing keyword argument fix<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Save original failing call inside of a regression test alongside a normal successful call. Test also missing input, supplying nil explicitly and types used by source payload&#8217;s keys. Each case tests different contracts. For wrappers run your test through the same entry point as used by the running application rather than testing just the destination.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If tests use substitutes, <a href=\"https:\/\/rspec.info\/features\/3-12\/rspec-mocks\/verifying-doubles\/instance-doubles\/\">RSpec\u2019s verifying instance doubles<\/a> compare calls against the real method\u2019s positional and keyword signature when that class is available. This is a documentation-based recommendation. These examples ran on official Ruby 4.0.0 WASI; native gems, a deployed application and an RSpec suite were not tested.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep exception handling narrow. After adding a guessed keyword, retrying an entire operation may repeat work done before a deeper call failed. Identify the failing definition, fix its caller and verify the expected value. Prefer a clear error near the input boundary over silently sending invented data further into the system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Takeaway<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To resolve a Ruby missing keyword argument error match the expected name provided in your error messages to your actual calling code. Consider whether string keys or symbol keys you use and whether defaults make sense in your codebase for required named arguments or forwarded through wrappers. Understand that present with nil is different than absent; fix where your caller lost track of providing the keyword, and ensure both correctness of presence and quality of value are verified independently during testing.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Trace missing Ruby keywords through method definitions, hashes and wrappers. Tested examples distinguish an absent keyword from a supplied nil value.<\/p>\n","protected":false},"author":3,"featured_media":1838,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby-tips"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":7}},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Ruby Missing Keyword Argument: Find and Fix It<\/title>\n<meta name=\"description\" content=\"Fix a Ruby missing keyword argument error with tested examples. Check required names, nil values, string keys, defaults and keyword forwarding.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ruby Missing Keyword Argument: Find and Fix It\" \/>\n<meta property=\"og:description\" content=\"Fix a Ruby missing keyword argument error with tested examples. Check required names, nil values, string keys, defaults and keyword forwarding.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/\" \/>\n<meta property=\"og:site_name\" content=\"Ruby-Doc Learn\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-17T09:41:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-17T09:41:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"1000\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"James Britt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Britt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/\"},\"author\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/james-britt\\\/#james-britt\"},\"headline\":\"Ruby Missing Keyword Argument: Find and Fix the Missing Name\",\"datePublished\":\"2026-11-17T09:41:42+00:00\",\"dateModified\":\"2026-11-17T09:41:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/\"},\"wordCount\":1430,\"publisher\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/ruby-missing-keyword-argument-presence.webp\",\"articleSection\":[\"Ruby tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/\",\"url\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/\",\"name\":\"Ruby Missing Keyword Argument: Find and Fix It\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/ruby-missing-keyword-argument-presence.webp\",\"datePublished\":\"2026-11-17T09:41:42+00:00\",\"dateModified\":\"2026-11-17T09:41:43+00:00\",\"description\":\"Fix a Ruby missing keyword argument error with tested examples. Check required names, nil values, string keys, defaults and keyword forwarding.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/#primaryimage\",\"url\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/ruby-missing-keyword-argument-presence.webp\",\"contentUrl\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/ruby-missing-keyword-argument-presence.webp\",\"width\":1600,\"height\":1000,\"caption\":\"A required keyword verifies that a name was sent. Check its value separately, and add a default only when omission is intended.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/ruby-missing-keyword-argument\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ruby Missing Keyword Argument: Find and Fix the Missing Name\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/#website\",\"url\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/\",\"name\":\"Ruby-Doc Learn\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/#organization\",\"name\":\"Ruby-Doc Learn\",\"url\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/ruby-doc-logo-transparent.png\",\"contentUrl\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/ruby-doc-logo-transparent.png\",\"width\":1650,\"height\":305,\"caption\":\"Ruby-Doc Learn\"},\"image\":{\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/james-britt\\\/#james-britt\",\"name\":\"James Britt\",\"image\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/jgb_self-portrait-20140914.png\",\"description\":\"Creator and long-term maintainer of Ruby-Doc.org, founder of Neurogami, and author of practical Ruby tutorials for Ruby-Doc Learn.\",\"sameAs\":[\"https:\\\/\\\/jamesbritt.com\\\/\",\"https:\\\/\\\/neurogami.com\\\/\",\"https:\\\/\\\/www.oreilly.com\\\/pub\\\/au\\\/2595\",\"https:\\\/\\\/www.rubyevents.org\\\/profiles\\\/james-britt\"],\"url\":\"https:\\\/\\\/ruby-doc.org\\\/learn\\\/james-britt\\\/\",\"jobTitle\":\"Ruby developer and writer\",\"knowsAbout\":[\"Ruby programming language\",\"Ruby documentation\",\"JRuby\",\"Open Sound Control\",\"Software development\"],\"affiliation\":{\"@type\":\"Organization\",\"name\":\"Ruby-Doc.org\",\"url\":\"https:\\\/\\\/ruby-doc.org\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ruby Missing Keyword Argument: Find and Fix It","description":"Fix a Ruby missing keyword argument error with tested examples. Check required names, nil values, string keys, defaults and keyword forwarding.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/","og_locale":"en_US","og_type":"article","og_title":"Ruby Missing Keyword Argument: Find and Fix It","og_description":"Fix a Ruby missing keyword argument error with tested examples. Check required names, nil values, string keys, defaults and keyword forwarding.","og_url":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/","og_site_name":"Ruby-Doc Learn","article_published_time":"2026-11-17T09:41:42+00:00","article_modified_time":"2026-11-17T09:41:43+00:00","og_image":[{"width":1600,"height":1000,"url":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp","type":"image\/webp"}],"author":"James Britt","twitter_card":"summary_large_image","twitter_misc":{"Written by":"James Britt","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/#article","isPartOf":{"@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/"},"author":{"@id":"https:\/\/ruby-doc.org\/learn\/james-britt\/#james-britt"},"headline":"Ruby Missing Keyword Argument: Find and Fix the Missing Name","datePublished":"2026-11-17T09:41:42+00:00","dateModified":"2026-11-17T09:41:43+00:00","mainEntityOfPage":{"@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/"},"wordCount":1430,"publisher":{"@id":"https:\/\/ruby-doc.org\/learn\/#organization"},"image":{"@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/#primaryimage"},"thumbnailUrl":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp","articleSection":["Ruby tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/","url":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/","name":"Ruby Missing Keyword Argument: Find and Fix It","isPartOf":{"@id":"https:\/\/ruby-doc.org\/learn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/#primaryimage"},"image":{"@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/#primaryimage"},"thumbnailUrl":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp","datePublished":"2026-11-17T09:41:42+00:00","dateModified":"2026-11-17T09:41:43+00:00","description":"Fix a Ruby missing keyword argument error with tested examples. Check required names, nil values, string keys, defaults and keyword forwarding.","breadcrumb":{"@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/#primaryimage","url":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp","contentUrl":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/11\/ruby-missing-keyword-argument-presence.webp","width":1600,"height":1000,"caption":"A required keyword verifies that a name was sent. Check its value separately, and add a default only when omission is intended."},{"@type":"BreadcrumbList","@id":"https:\/\/ruby-doc.org\/learn\/ruby-missing-keyword-argument\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ruby-doc.org\/learn\/"},{"@type":"ListItem","position":2,"name":"Ruby Missing Keyword Argument: Find and Fix the Missing Name"}]},{"@type":"WebSite","@id":"https:\/\/ruby-doc.org\/learn\/#website","url":"https:\/\/ruby-doc.org\/learn\/","name":"Ruby-Doc Learn","description":"","publisher":{"@id":"https:\/\/ruby-doc.org\/learn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ruby-doc.org\/learn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ruby-doc.org\/learn\/#organization","name":"Ruby-Doc Learn","url":"https:\/\/ruby-doc.org\/learn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ruby-doc.org\/learn\/#\/schema\/logo\/image\/","url":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/09\/ruby-doc-logo-transparent.png","contentUrl":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/09\/ruby-doc-logo-transparent.png","width":1650,"height":305,"caption":"Ruby-Doc Learn"},"image":{"@id":"https:\/\/ruby-doc.org\/learn\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/ruby-doc.org\/learn\/james-britt\/#james-britt","name":"James Britt","image":"https:\/\/ruby-doc.org\/learn\/wp-content\/uploads\/2026\/09\/jgb_self-portrait-20140914.png","description":"Creator and long-term maintainer of Ruby-Doc.org, founder of Neurogami, and author of practical Ruby tutorials for Ruby-Doc Learn.","sameAs":["https:\/\/jamesbritt.com\/","https:\/\/neurogami.com\/","https:\/\/www.oreilly.com\/pub\/au\/2595","https:\/\/www.rubyevents.org\/profiles\/james-britt"],"url":"https:\/\/ruby-doc.org\/learn\/james-britt\/","jobTitle":"Ruby developer and writer","knowsAbout":["Ruby programming language","Ruby documentation","JRuby","Open Sound Control","Software development"],"affiliation":{"@type":"Organization","name":"Ruby-Doc.org","url":"https:\/\/ruby-doc.org\/"}}]}},"_links":{"self":[{"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/posts\/1839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/comments?post=1839"}],"version-history":[{"count":1,"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/posts\/1839\/revisions"}],"predecessor-version":[{"id":1842,"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/posts\/1839\/revisions\/1842"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/media\/1838"}],"wp:attachment":[{"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/media?parent=1839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/categories?post=1839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ruby-doc.org\/learn\/wp-json\/wp\/v2\/tags?post=1839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}