{"record":{"id":"6128c1d9a0dc9e78","repo":"ruby/ruby","slug":"extensions-can-now-be-generated-using-c-or-rust-s","errorCode":null,"errorMessage":"Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension.","messagePattern":"Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed\\. Please select a language, e\\.g\\. `--ext=rust` to generate a Rust extension\\.","errorType":"exception","errorClass":"InvalidOption","httpStatus":null,"severity":"error","filePath":"lib/bundler/cli.rb","lineNumber":719,"sourceCode":"        if exec_used + help_used == 1\n          %w[help exec]\n        else\n          args\n        end\n      elsif help_used\n        args = args.dup\n        args.delete_at(help_used)\n        [\"help\", command || args].flatten.compact\n      else\n        args\n      end\n    end\n\n    def self.check_invalid_ext_option(arguments)\n      # when invalid version of `--ext` is called\n      if invalid_ext_value?(arguments)\n        removed_message = \"Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension.\"\n        raise InvalidOption, removed_message\n      end\n    end\n\n    def self.invalid_ext_value?(arguments)\n      index = arguments.index(\"--ext\")\n      next_argument = arguments[index + 1]\n\n      # it is ok when --ext is followed with valid extension value\n      # for example `bundle gem hello --ext c`\n      return false if EXTENSIONS.include?(next_argument)\n\n      # invalid call when --ext is called with no value in last position\n      # for example `bundle gem hello_gem --ext`\n      return true if next_argument.nil?\n\n      # invalid call when --ext is followed by other parameter\n      # for example `bundle gem --ext --no-ci hello_gem`\n      return true if next_argument.start_with?(\"-\")","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/ruby/ruby/blob/0e5b888e1c355f3f728f2659f085820937dada48/lib/bundler/cli.rb#L701-L737","documentation":"`bundle gem --ext` with no language argument used to default to a C extension. Extensions can now be C, Rust, or Go, so a bare `--ext` (or one followed by a value not in EXTENSIONS) raises Bundler::InvalidOption from Bundler::CLI.check_invalid_ext_option (lib/bundler/cli.rb:719). The language must be named explicitly.","triggerScenarios":"`bundle gem mygem --ext` as the last argument, or `--ext` followed by a value not in EXTENSIONS (\"c\", \"rust\", \"go\") — e.g. `--ext cpp`, or `--ext` immediately followed by another flag.","commonSituations":"Old tutorials and scaffolders using bundler 1.x/early 2.x bare `--ext`; developers wanting a Rust native extension for the first time.","solutions":["Pass the language explicitly: `--ext=c`, `--ext=rust`, or `--ext=go`","Double-check the value's spelling — only c, rust, and go are valid","Update generators that emit a bare --ext"],"exampleFix":"# before\n$ bundle gem mygem --ext\n\n# after\n$ bundle gem mygem --ext=rust","handlingStrategy":"validation","validationCode":"EXTS = %w[c rust go].freeze\ni = args.index('--ext')\nif i && !EXTS.include?(args[i + 1])\n  abort 'pass a language explicitly: --ext=c, --ext=rust, or --ext=go'\nend\nsystem('bundle', 'gem', name, *args)","typeGuard":null,"tryCatchPattern":"begin\n  Bundler::CLI.start(['gem', name, *args])\nrescue Bundler::InvalidOption\n  raise unless args.include?('--ext')\n  lang = ask('extension language (c/rust/go): ')\n  args.delete('--ext')\n  Bundler::CLI.start(['gem', name, \"--ext=#{lang}\", *args])\nend","preventionTips":["Always pass an explicit language with --ext","Pin scaffolders and templates that emit --ext to also emit the value","Validate the value against c/rust/go before invoking the CLI"],"tags":["bundler","cli","removed-flag","gem-scaffold","native-extension"],"backgroundTag":"removed-cli-flag","analyzedSha":"0e5b888e1c355f3f728f2659f085820937dada48","analyzedAt":"2026-08-21T14:25:43.473Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}