{"record":{"id":"da3a0829e97da131","repo":"oraios/serena","slug":"failed-to-check-or-install-solargraph-error-msg","errorCode":null,"errorMessage":"Failed to check or install Solargraph: {error_msg}\nPlease try installing manually: gem install solargraph","messagePattern":"Failed to check or install Solargraph: (.+?)\nPlease try installing manually: gem install solargraph","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/solargraph.py","lineNumber":192,"sourceCode":"                    \"installCommand\": \"gem install solargraph -v 0.51.1\",\n                    \"binaryName\": \"solargraph\",\n                    \"archiveType\": \"gem\",\n                }\n            ]\n\n            dependency = runtime_dependencies[0]\n            try:\n                result = subprocess_run(\n                    [\"gem\", \"list\", \"^solargraph$\", \"-i\"], check=False, capture_output=True, text=True, cwd=repository_root_path\n                )\n                if result.stdout.strip() == \"false\":\n                    log.info(\"Installing Solargraph...\")\n                    subprocess_run(dependency[\"installCommand\"].split(), check=True, capture_output=True, cwd=repository_root_path)\n\n                return \"gem exec solargraph\"\n            except subprocess.CalledProcessError as e:\n                error_msg = e.stderr.decode() if e.stderr else str(e)\n                raise RuntimeError(\n                    f\"Failed to check or install Solargraph: {error_msg}\\nPlease try installing manually: gem install solargraph\"\n                ) from e\n        else:\n            raise RuntimeError(\n                \"This appears to be a Bundler project, but solargraph is not available. \"\n                \"Please add 'gem \\\"solargraph\\\"' to your Gemfile and run 'bundle install'.\"\n            )\n\n    @staticmethod\n    def _detect_rails_project(repository_root_path: str) -> bool:\n        \"\"\"\n        Detect if this is a Rails project by checking for Rails-specific files.\n        \"\"\"\n        rails_indicators = [\n            \"config/application.rb\",\n            \"config/environment.rb\",\n            \"app/controllers/application_controller.rb\",\n            \"Rakefile\",","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/solargraph.py#L174-L210","documentation":"SolidLSP's Ruby server (Solargraph) tries to verify or auto-install the solargraph gem by shelling out to gem/bundle. If that subprocess exits non-zero (CalledProcessError), _setup_runtime_dependencies raises this RuntimeError and points the developer at the manual install command. It means the language server binary could not be provisioned, so the server cannot start.","triggerScenarios":"Instantiating the Solargraph language server when `gem exec solargraph` (or the dependency check) fails: gem/bundle not on PATH, no network for `gem install solargraph`, or a Bundler-project install command failing with a non-zero exit code.","commonSituations":"Docker/CI images without Ruby gems, missing write permissions to the gem directory (GEM_HOME), corporate proxies blocking rubygems.org, or a project Gemfile.lock that pins no solargraph version.","solutions":["Run `gem install solargraph` manually and confirm `gem exec solargraph --version` works on PATH.","Ensure Ruby and the gem CLI are installed and on PATH (`ruby -v`, `gem -v`).","For Bundler projects, add `gem \"solargraph\"` to the Gemfile and run `bundle install`.","Check network/proxy access to rubygems.org and set GEM_HOME/GEM_PATH if gems install to a non-default location."],"exampleFix":"// before: server init fails in slim CI image\n# Dockerfile: ruby:slim\n// after\n# Dockerfile: ruby:slim\nRUN gem install solargraph --no-document","handlingStrategy":"validation","validationCode":"import shutil, subprocess\nif not shutil.which(\"gem\"):\n    raise SystemExit(\"Ruby gem CLI required\")\nr = subprocess.run([\"gem\", \"list\", \"solargraph\", \"-e\"], capture_output=True, text=True)\nif \"solargraph\" not in r.stdout:\n    subprocess.run([\"gem\", \"install\", \"solargraph\", \"--no-document\"], check=True)","typeGuard":"def solargraph_available() -> bool:\n    import shutil, subprocess\n    return bool(shutil.which(\"gem\")) and subprocess.run(\n        [\"gem\", \"list\", \"solargraph\", \"-e\"], capture_output=True, text=True\n    ).returncode == 0 and \"solargraph\" in subprocess.run(\n        [\"gem\", \"list\", \"solargraph\", \"-e\"], capture_output=True, text=True\n    ).stdout","tryCatchPattern":"try:\n    server = SolargraphLanguageServer(config, repo_root, settings)\nexcept RuntimeError as e:\n    if \"gem install solargraph\" in str(e):\n        subprocess.run([\"gem\", \"install\", \"solargraph\", \"--no-document\"], check=True)\n        server = SolargraphLanguageServer(config, repo_root, settings)\n    else:\n        raise","preventionTips":["Bake `gem install solargraph --no-document` into Dockerfiles/CI setup scripts.","For Bundler projects, always add solargraph to the Gemfile and commit Gemfile.lock.","Check `which gem` and GEM_HOME before initializing the server."],"tags":["ruby","dependency-install","subprocess","solargraph"],"backgroundTag":"language-server-dependency-install-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}