Skip to content

[BUG] Missing require 'pathname' in attachment.rb #614

@andyw8

Description

@andyw8

Basic checks

  • I searched existing issues - this hasn't been reported
  • I can reproduce this consistently
  • This is a RubyLLM bug, not my application code

What's broken?

The RubyLLM::Attachment class uses Pathname but doesn't require it, causing an uninitialized constant RubyLLM::Attachment::Pathname error when creating attachments from file paths.

How to reproduce

ruby -e "require 'ruby_llm'; RubyLLM::Attachment.new('test.jpg')"

See error: uninitialized constant RubyLLM::Attachment::Pathname

Expected behavior

The Attachment class should successfully create an attachment from a file path without errors.

What actually happened

Error occurs because lib/ruby_llm/attachment.rb uses Pathname on lines 21 and 164 but is missing require 'pathname' at the top of the file.

Error message:

uninitialized constant RubyLLM::Attachment::Pathname

Environment

  • Ruby version: 3.4.8
  • RubyLLM version: 1.12.0
  • Provider: Anthropic
  • OS: macOS (Darwin 24.6.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions