{"record":{"id":"e1ca6c9bcd066c1c","repo":"OpenAPITools/openapi-generator","slug":"invalid-http-library-getlibrary-only-fa","errorCode":null,"errorMessage":"Invalid HTTP library \" + getLibrary() + \". Only faraday, typhoeus and httpx are supported.","messagePattern":"Invalid HTTP library \" \\+ getLibrary\\(\\) \\+ \"\\. Only faraday, typhoeus and httpx are supported\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java","lineNumber":304,"sourceCode":"        supportingFiles.add(new SupportingFile(\"Gemfile.mustache\", \"\", \"Gemfile\"));\n        supportingFiles.add(new SupportingFile(\"rubocop.mustache\", \"\", \".rubocop.yml\"));\n        supportingFiles.add(new SupportingFile(\"travis.mustache\", \"\", \".travis.yml\"));\n        supportingFiles.add(new SupportingFile(\"gitlab-ci.mustache\", \"\", \".gitlab-ci.yml\"));\n        supportingFiles.add(new SupportingFile(\"gemspec.mustache\", \"\", gemName + \".gemspec\"));\n        supportingFiles.add(new SupportingFile(\"configuration.mustache\", gemFolder, \"configuration.rb\"));\n        supportingFiles.add(new SupportingFile(\"api_client.mustache\", gemFolder, \"api_client.rb\"));\n\n        if (TYPHOEUS.equals(getLibrary())) {\n            // for Typhoeus\n            additionalProperties.put(\"isTyphoeus\", Boolean.TRUE);\n        } else if (FARADAY.equals(getLibrary())) {\n            // for Faraday\n            additionalProperties.put(\"isFaraday\", Boolean.TRUE);\n        } else if (HTTPX.equals(getLibrary())) {\n            // for Faraday\n            additionalProperties.put(\"isHttpx\", Boolean.TRUE);\n        } else {\n            throw new IllegalArgumentException(\"Invalid HTTP library \" + getLibrary() + \". Only faraday, typhoeus and httpx are supported.\");\n        }\n\n        // test files should not be overwritten\n        supportingFiles.add(new SupportingFile(\"rspec.mustache\", \"\", \".rspec\")\n                .doNotOverwrite());\n        supportingFiles.add(new SupportingFile(\"spec_helper.mustache\", specFolder, \"spec_helper.rb\")\n                .doNotOverwrite());\n\n        // add lambda to convert a symbol to a string if an underscore is included (e.g. :'user_uuid' => 'user_uuid')\n        additionalProperties.put(\"lambdaFixHeaderKey\", new Mustache.Lambda() {\n            @Override\n            public void execute(Template.Fragment fragment, Writer writer) throws IOException {\n                String content = fragment.execute();\n                if (content.contains(\"_\")) {\n                    content = content.substring(1);\n                }\n                writer.write(content);\n            }","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java#L286-L322","documentation":"The Ruby client generator supports exactly three HTTP libraries: faraday, typhoeus, and httpx. processOpts() sets an isTyphoeus/isFaraday/isHttpx template flag for the matching value and throws IllegalArgumentException for anything else, so the templates always have exactly one HTTP adapter selected.","triggerScenarios":"openapi-generator-cli generate -i api.yaml -g ruby -l net-http / -l faraday_middleware / -l Faraday. Comparison is exact/lowercase; capitalization or underscores fail.","commonSituations":"Assuming any Ruby HTTP gem name works; copy-pasting a -l value from java/python docs; upgrading from older generator versions where fewer libraries existed and scripts pinned an invalid default like 'typhoeus-faraday'.","solutions":["Use exactly -l faraday, -l typhoeus, or -l httpx","Omit -l to use the generator default","Pick faraday unless you specifically need typhoeus or httpx features"],"exampleFix":"# before\nopenapi-generator-cli generate -i api.yaml -g ruby -l net-http\n# after\nopenapi-generator-cli generate -i api.yaml -g ruby -l faraday","handlingStrategy":"validation","validationCode":"# bash: whitelist the library before generating\nRUBY_LIBS='faraday typhoeus httpx'\n[[ \" ${RUBY_LIBS} \" == *\" ${RUBY_LIBRARY:-faraday} \"* ]] || { echo \"-l must be one of: ${RUBY_LIBS}\"; exit 1; }\nopenapi-generator-cli generate -i api.yaml -g ruby -l \"${RUBY_LIBRARY:-faraday}\"","typeGuard":null,"tryCatchPattern":"try {\n    RubyClientCodegen codegen = new RubyClientCodegen();\n    codegen.setLibrary(\"faraday\");\n    new DefaultGenerator().opts(new ClientOptInput().opts(codegen)).generate();\n} catch (IllegalArgumentException e) {\n    // 'Invalid HTTP library ...' - only faraday, typhoeus, httpx; fix and rerun\n}","preventionTips":["Pin the library value in version-controlled CI config, not in ad-hoc commands","Values are case-sensitive lowercase with no separators","Default to faraday unless you need typhoeus/httpx specifics"],"tags":["ruby","codegen","configuration","http-library","openapi-generator"],"backgroundTag":"unsupported-library-option","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}