{"id":34565745,"url":"https://github.com/barodeur/llm_rescuer","last_synced_at":"2026-02-08T11:29:53.912Z","repository":{"id":320558694,"uuid":"1082483254","full_name":"barodeur/llm_rescuer","owner":"barodeur","description":"Fix the Billion Dollar Mistake with an LLM","archived":false,"fork":false,"pushed_at":"2025-10-24T13:03:26.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-24T14:17:32.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barodeur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-24T10:00:32.000Z","updated_at":"2025-10-24T13:53:28.000Z","dependencies_parsed_at":"2025-10-24T14:17:47.441Z","dependency_job_id":"f03b2c52-2084-4e15-9a0d-3479e2eed6ee","html_url":"https://github.com/barodeur/llm_rescuer","commit_stats":null,"previous_names":["barodeur/llm_rescuer"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/barodeur/llm_rescuer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barodeur%2Fllm_rescuer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barodeur%2Fllm_rescuer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barodeur%2Fllm_rescuer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barodeur%2Fllm_rescuer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barodeur","download_url":"https://codeload.github.com/barodeur/llm_rescuer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barodeur%2Fllm_rescuer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29229290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T09:43:19.170Z","status":"ssl_error","status_checked_at":"2026-02-08T09:42:55.556Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T09:04:04.280Z","updated_at":"2026-02-08T11:29:53.906Z","avatar_url":"https://github.com/barodeur.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# LLM Rescuer 🤖💰\n\n\u003e ⚠️ **EXPERIMENTAL PROJECT - NOT FOR PRODUCTION USE**\n\u003e\n\u003e This project is an experimental proof-of-concept developed for educational purposes and pure, unadulterated fun. It uses AI to dynamically handle runtime errors, which introduces unpredictable behavior and potential security risks that would make your security team cry. **Never use this in production environments unless you enjoy explaining to your boss why the AI decided your user's name should be \"🐱 Mr. Whiskers\".**\n\n## The Mission: Fixing the Billion Dollar Mistake... With a Billion Dollars Worth of LLM Tokens\n\nIn 1965, Tony Hoare invented the null reference and later called it his [\"billion-dollar mistake\"](https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare/). Well, we're here to fix it by potentially spending a billion dollars in OpenAI API tokens! 💸\n\nBecause clearly, the best way to solve a problem caused by the absence of a value is to throw artificial intelligence at it until it hallucinates a reasonable response. What could possibly go wrong?\n\n## What This Abomination Does\n\nLLM Rescuer is a Ruby gem that catches your `NoMethodError`s when you call methods on `nil` and asks GPT to guess what you _probably_ wanted. It's like having a very expensive, overly-confident intern who's read your entire codebase and thinks they know what you meant.\n\n```ruby\nuser = nil\nputs user.name  # Instead of crashing, might return \"John Doe\" or \"undefined\" or \"🎭\"\n                # depending on what the AI thinks is funny today\n```\n\n## How This Beautiful Disaster Works\n\n1. **The Trap**: We monkey-patch `NilClass` because why not break fundamental assumptions?\n2. **The Analysis**: When you call a method on `nil`, we pause everything and ask an LLM to read your mind\n3. **The Oracle**: GPT-5 analyzes your code like a digital Sherlock Holmes with ADHD\n4. **The Guess**: It returns what it thinks you wanted, which is right about 73.2% of the time\\*\n5. **The Magic**: Your code continues running, probably doing something completely different than intended\n\n\\*Statistics may be made up\n\n## Installation (AKA \"How to Spend Your OpenAI Credits\")\n\nAdd this line to your application's Gemfile (and say goodbye to your API budget):\n\n```ruby\ngem 'llm_rescuer'\n```\n\nThen execute:\n\n```bash\nbundle install\n# Also install a second mortgage for your OpenAI bills\n```\n\n## Configuration\n\n1. **Feed the AI overlords**:\n\n   ```bash\n   export OPENAI_API_KEY=\"prepare-your-wallet\"\n   ```\n\n2. **Set your project scope** (so it only ruins _your_ code):\n\n   ```ruby\n   LlmRescuer.prefix = \"/path/to/your/beautiful/disaster\"\n   ```\n\n3. **Embrace the chaos**:\n   ```ruby\n   require 'llm_rescuer'\n   LlmRescuer.setup\n   # You have chosen... poorly\n   ```\n\n## Real-World Usage Examples\n\n```ruby\n# Classic nil safety\nuser = find_user(id: \"nonexistent\") # returns nil\nputs user.email\n# AI: \"Analyzing context... user seems to need an email...\n#      returning 'no-reply@example.com'\"\n\n# Shopping cart magic\ncart = session[:cart] # nil because session expired\ntotal = cart.total_price\n# AI: \"This looks like e-commerce. Based on similar patterns,\n#      I'll return 0.0 to avoid charging $nil\"\n\n# The existential crisis\nmeaning_of_life = nil\nanswer = meaning_of_life.to_i\n# AI: \"Clearly this should be 42. I've read Douglas Adams.\"\n```\n\n## What Could Go Wrong? 🤔\n\n- Your nil users might suddenly become named \"ChatGPT's Best Friend\"\n- Your shopping cart totals might be replaced with haikus about commerce\n- Your boolean flags might return philosophical treatises on truth\n- Your API might start responding with interpretive dance descriptions\n- You might accidentally achieve sentience in your nil objects\n\n## Cost Analysis 💰\n\n- **Traditional nil handling**: Free, but your app crashes\n- **LLM Rescuer**: $0.002 per nil rescue (estimated)\n- **Your sanity**: Priceless (and rapidly depleting)\n\nFor a typical Rails app with healthy nil hygiene, expect to spend approximately:\n\n- **Development**: $50-100/month (because you test things, right?)\n- **Production**: $500-5000/month (depending on how nil-happy your code is)\n- **Black Friday**: Your firstborn child\n\n## Dependencies (The Usual Suspects)\n\n- `ruby_llm` (~\u003e 1.8.2) - For talking to our AI overlords\n- `ruby_llm-schema` (~\u003e 0.2.1) - For making sure AI responses are structured chaos\n- `binding_of_caller` (~\u003e 1.0.1) - For context that the AI will probably ignore anyway\n- A sense of humor (\u003e= 1.0.0, required)\n- A healthy bank account (recommended)\n\n## Development\n\nAfter checking out the repo and questioning your life choices:\n\n```bash\nbin/setup    # Install dependencies\nrake spec    # Run tests (spoiler: they're as unpredictable as AI)\nbin/console  # Interactive prompt for immediate regret\n```\n\n## Contributing\n\nFound a bug? That might be a feature! Found a feature? That might be a bug!\n\nSubmit PRs, issues, or interpretive dance videos explaining your problems. We accept contributions in all forms except sensible ones.\n\n## Success Stories\n\n\u003e \"LLM Rescuer saved my app from crashing! Sure, all my users are now named 'Anonymous Penguin' and my prices are in Bitcoin, but it didn't crash!\" - Definitely Real User\n\n\u003e \"I deployed this to production and my nil errors went down 100%! My AWS bill went up 400%, but correlation isn't causation, right?\" - Another Real Person\n\n## The Philosophy\n\nWhy fix your code when you can train an AI to guess what your code should have done? It's like pair programming, except your pair is a probabilistic text generator that's read the entire internet and has strong opinions about variable naming.\n\n## License\n\nThis project is licensed under the MIT License, which gives you the right to use, modify, and distribute this code. It does not give you the right to sue us when your production app starts writing poetry instead of processing payments.\n\n## Final Words\n\nRemember: null references were a billion-dollar mistake, but with today's AI API pricing, we can make it a trillion-dollar mistake! 🚀\n\n---\n\n_\"In a world without nil safety, one gem dares to ask: 'What if we just guessed?'\"_ 🎬\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarodeur%2Fllm_rescuer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarodeur%2Fllm_rescuer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarodeur%2Fllm_rescuer/lists"}