{"record":{"id":"59755534b0153f43","repo":"pry/pry","slug":"no-docs-found-for-obj-name-current-context","errorCode":null,"errorMessage":"No docs found for: #{obj_name || 'current context'}","messagePattern":"No docs found for: #(.+?)","errorType":"exception","errorClass":"Pry::CommandError","httpStatus":null,"severity":"warning","filePath":"lib/pry/commands/show_doc.rb","lineNumber":42,"sourceCode":"      # The docs for code_object prepared for display.\n      def content_for(code_object)\n        Code.new(\n          render_doc_markup_for(code_object),\n          start_line_for(code_object),\n          :text\n        ).with_line_numbers(use_line_numbers?).to_s\n      end\n\n      # process the markup (if necessary) and apply colors\n      def render_doc_markup_for(code_object)\n        docs = docs_for(code_object)\n\n        if code_object.command?\n          # command '--help' shouldn't use markup highlighting\n          docs\n        else\n          if docs.empty?\n            raise CommandError, \"No docs found for: #{obj_name || 'current context'}\"\n          end\n\n          process_comment_markup(docs)\n        end\n      end\n\n      # Return docs for the code_object, adjusting for whether the code_object\n      # has yard docs available, in which case it returns those.\n      # (note we only have to check yard docs for modules since they can\n      # have multiple docs, but methods can only be doc'd once so we\n      # dont need to check them)\n      def docs_for(code_object)\n        if code_object.module_with_yard_docs?\n          # yard docs\n          code_object.yard_doc\n        else\n          # normal docs (i.e comments above method/module/command)\n          code_object.doc","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/pry/pry/blob/135640262879544c6bfecbf3e78511289bfe956c/lib/pry/commands/show_doc.rb#L24-L60","documentation":"Thrown by `show-doc` when the requested code object is found but its documentation string is empty. render_doc_markup_for calls docs_for(code_object); for non-command objects, an empty docs string triggers this error — i.e. the method/class simply has no comment above it (or no YARD docs where relevant).","triggerScenarios":"Running `show-doc Array#map`, `show-doc String#gsub` or other core methods without the pry-doc gem installed (no C-source comments available); calling show-doc on your own undocumented methods or classes.","commonSituations":"Fresh Pry installs without pry-doc; inspecting C-defined core/stdlib methods; codebases that don't comment methods.","solutions":["Install pry-doc to get docs for C-defined core/stdlib methods: `gem install pry-doc`","For your own code, add a comment above the method/class and retry","Use `show-source <name>` instead when you want the implementation rather than the docs"],"exampleFix":"# before\nshow-doc Array#map\n# No docs found for: Array#map\n\n# after (shell)\ngem install pry-doc\n# in a new pry session\nshow-doc Array#map","handlingStrategy":"validation","validationCode":"# confirm non-empty docs before show-doc\nobj = Pry::CodeObject.lookup('Array#map', _pry_)\nobj && !obj.doc.to_s.strip.empty?","typeGuard":"def documented?(name, pry)\n  obj = Pry::CodeObject.lookup(name, pry)\n  !obj.nil? && !obj.doc.to_s.strip.empty?\nend","tryCatchPattern":"begin\n  pry_instance.run 'show-doc', name\nrescue Pry::CommandError => e\n  raise unless e.message.include?('No docs found')\n  pry_instance.run 'show-source', name # fall back to the implementation\nend","preventionTips":["Install pry-doc alongside pry in dev environments","Comment your methods if you expect to browse docs for them","Use show-source when docs are absent — the code is the truth"],"tags":["ruby","pry","show-doc","no-documentation","pry-doc","core-methods"],"backgroundTag":"no-documentation-available","analyzedSha":"135640262879544c6bfecbf3e78511289bfe956c","analyzedAt":"2026-08-21T19:07:03.985Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}