{"record":{"id":"4a0439765079d9a1","repo":"oraios/serena","slug":"error-checking-ruby-installation-error-msg-ple","errorCode":null,"errorMessage":"Error checking Ruby installation: {error_msg}. Please ensure Ruby is properly installed and in PATH.","messagePattern":"Error checking Ruby installation: (.+?)\\. Please ensure Ruby is properly installed and in PATH\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/ruby_lsp.py","lineNumber":182,"sourceCode":"\n        # Check if Ruby is installed\n        try:\n            result = subprocess_run(ruby_cmd + [\"--version\"], check=True, capture_output=True, cwd=repository_root_path, text=True)\n            ruby_version = result.stdout.strip()\n            log.info(f\"Ruby version: {ruby_version}\")\n\n            # Extract version number for compatibility checks\n            import re\n\n            version_match = re.search(r\"ruby (\\d+)\\.(\\d+)\\.(\\d+)\", ruby_version)\n            if version_match:\n                major, minor, patch = map(int, version_match.groups())\n                if major < 2 or (major == 2 and minor < 6):\n                    log.warning(f\"Warning: Ruby {major}.{minor}.{patch} detected. ruby-lsp works best with Ruby 2.6+\")\n\n        except subprocess.CalledProcessError as e:\n            error_msg = e.stderr if isinstance(e.stderr, str) else e.stderr.decode() if e.stderr else \"Unknown error\"\n            raise RuntimeError(\n                f\"Error checking Ruby installation: {error_msg}. Please ensure Ruby is properly installed and in PATH.\"\n            ) from e\n        except FileNotFoundError as e:\n            raise RuntimeError(\n                \"Ruby is not installed or not found in PATH. Please install Ruby using one of these methods:\\n\"\n                \"  - Using mise:  mise install ruby && mise use ruby  (https://mise.jdx.dev)\\n\"\n                \"  - Using rbenv: rbenv install 3.0.0 && rbenv global 3.0.0\\n\"\n                \"  - Using asdf:  asdf install ruby 3.0.0 && asdf global ruby 3.0.0\\n\"\n                \"  - Using RVM:   rvm install 3.0.0 && rvm use 3.0.0 --default\\n\"\n                \"  - System package manager (brew install ruby, apt install ruby, etc.)\"\n            ) from e\n\n        # Check for Bundler project (Gemfile exists)\n        gemfile_path = os.path.join(repository_root_path, \"Gemfile\")\n        gemfile_lock_path = os.path.join(repository_root_path, \"Gemfile.lock\")\n        is_bundler_project = os.path.exists(gemfile_path)\n\n        if is_bundler_project:","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/ruby_lsp.py#L164-L200","documentation":"During `_setup_runtime_dependencies` the wrapper shells out to `ruby --version` with `check=True`; when Ruby itself runs but the command fails (non-zero exit), the `subprocess.CalledProcessError` is caught and re-raised as this RuntimeError including Ruby's stderr, telling the user to ensure Ruby is properly installed and in PATH.","triggerScenarios":"Constructing ruby-lsp when the `ruby --version` invocation exits non-zero with stderr output — e.g. a corrupted Ruby install, a ruby wrapper script (rbenv shims, ASDF) failing because its underlying version is gone, or permission/ABI errors executing the binary.","commonSituations":"rbenv/rvm/asdf shim pointing at an uninstalled Ruby version; a partially upgraded Homebrew Ruby with broken dylibs; container image where /usr/bin/ruby is a stub that errors; disk/permission issues making the binary unexecutable.","solutions":["Fix the Ruby manager state: run `rbenv rehash` / reinstall the active version (`rbenv install <ver> && rbenv global <ver>`) or `asdf resinstall ruby`","Verify `ruby --version` works directly in the launching shell and repair/reinstall Homebrew or system Ruby if it errors","Point PATH at a known-good Ruby before instantiating, or reinstall Ruby via mise/rvm"],"exampleFix":"# before\n$ ruby --version  # rbenv: version '3.1.2' is not installed (exit 1)\n\n# after\n$ rbenv install 3.1.2 && rbenv global 3.1.2 && rbenv rehash\n$ ruby --version  # ruby 3.1.2p20 (exit 0)","handlingStrategy":"try-catch","validationCode":"import subprocess\ntry:\n    subprocess.run([\"ruby\", \"--version\"], capture_output=True, check=True)\nexcept (subprocess.CalledProcessError, FileNotFoundError) as e:\n    raise SystemExit(f\"Ruby is broken or missing; fix ruby before starting: {e}\")","typeGuard":"def ruby_works() -> bool:\n    try:\n        return subprocess.run([\"ruby\", \"--version\"], capture_output=True, check=False).returncode == 0\n    except FileNotFoundError:\n        return False","tryCatchPattern":"try:\n    server = RubyLSP(config, repo_root, settings)\nexcept RuntimeError as e:\n    if \"Error checking Ruby installation\" in str(e):\n        logger.error(\"ruby --version failed; fix rbenv/asdf state or reinstall Ruby: %s\", e)\n        raise SystemExit(1) from e\n    raise","preventionTips":["Keep rbenv/rvm/asdf shims healthy: rehash after installs and remove shims for deleted versions","Verify `ruby --version` in CI before jobs that instantiate ruby-lsp","Use mise/rvm with pinned versions committed to the repo so all environments match"],"tags":["ruby","environment","subprocess","path"],"backgroundTag":"command-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}