{"record":{"id":"51b4a8a19712a8bb","repo":"bblimke/webmock","slug":"unable-to-open-specified-file","errorCode":null,"errorMessage":"Unable to open specified file.","messagePattern":"Unable to open specified file\\.","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/webmock/http_lib_adapters/patron_adapter.rb","lineNumber":65,"sourceCode":"\n        def self.enable!\n          Patron.send(:remove_const, :Session)\n          Patron.send(:const_set, :Session, WebMockPatronSession)\n        end\n\n        def self.disable!\n          Patron.send(:remove_const, :Session)\n          Patron.send(:const_set, :Session, OriginalPatronSession)\n        end\n\n        def self.handle_file_name(req, webmock_response)\n          if req.action == :get && req.file_name\n            begin\n              File.open(req.file_name, \"w\") do |f|\n                f.write webmock_response.body\n              end\n            rescue Errno::EACCES\n              raise ArgumentError.new(\"Unable to open specified file.\")\n            end\n          end\n        end\n\n        def self.build_request_signature(req)\n          uri = WebMock::Util::URI.heuristic_parse(req.url)\n          uri.path = uri.normalized_path.gsub(\"[^:]//\",\"/\")\n\n          if [:put, :post, :patch].include?(req.action)\n            if req.file_name\n              if !File.exist?(req.file_name) || !File.readable?(req.file_name)\n                raise ArgumentError.new(\"Unable to open specified file.\")\n              end\n              request_body = File.read(req.file_name)\n            elsif req.upload_data\n              request_body = req.upload_data\n            else\n              raise ArgumentError.new(\"Must provide either data or a filename when doing a PUT or POST\")","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/bblimke/webmock/blob/b187df8827e1f08a1684a8ddc0a5050dbd449c16/lib/webmock/http_lib_adapters/patron_adapter.rb#L47-L83","documentation":"Error \"Unable to open specified file.\" thrown in bblimke/webmock.","triggerScenarios":"Thrown at lib/webmock/http_lib_adapters/patron_adapter.rb:65 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":"b187df8827e1f08a1684a8ddc0a5050dbd449c16","analyzedAt":"2026-08-23T02:55:22.028Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}