{"record":{"id":"6f24b80f8bc6628e","repo":"jdx/mise","slug":"erlang-does-not-yet-support-refs","errorCode":null,"errorMessage":"erlang does not yet support refs","messagePattern":"erlang does not yet support refs","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/plugins/core/erlang.rs","lineNumber":565,"sourceCode":"            .unwrap_or(\"Erlang/OTP source\");\n        ctx.pr.set_message(format!(\"Downloading {display_name}\"));\n        if !source_path.exists() {\n            HTTP.download_file(source_url, &source_path, Some(ctx.pr.as_ref()))\n                .await?;\n        }\n        self.verify_checksum(ctx, &mut tv, &source_path)?;\n\n        let kerl_base_dir = self.kerl_base_dir();\n        let kerl_source_path = kerl_base_dir\n            .join(\"archives\")\n            .join(format!(\"{}.tar.gz\", Self::release_tag(&tv.version)));\n        file::create_dir_all(kerl_source_path.parent().unwrap())?;\n        file::copy(&source_path, &kerl_source_path)?;\n\n        file::remove_all(tv.install_path())?;\n        match &tv.request {\n            ToolRequest::Ref { .. } => {\n                unimplemented!(\"erlang does not yet support refs\");\n            }\n            _ => {\n                let mut cmd = cmd!(\n                    self.kerl_path(),\n                    \"build-install\",\n                    &tv.version,\n                    &tv.version,\n                    tv.install_path()\n                )\n                .env(\"MAKEFLAGS\", format!(\"-j{}\", num_cpus::get()));\n                for (key, value) in source_build_kerl_env(tv.install_env(), &kerl_base_dir) {\n                    cmd = match value {\n                        Some(value) => cmd.env(key, value),\n                        None => cmd.env_remove(key),\n                    };\n                }\n                cmd.run()?;\n            }","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/jdx/mise/blob/6bd4a54fadcdf3a6757cc44061a9528b48dd2ae7/src/plugins/core/erlang.rs#L547-L583","documentation":"mise's built-in Erlang/OTP backend builds from source with kerl when no precompiled build applies (Linux source builds, `erlang.compile` settings, or missing erlef/otp_builds assets). In `install_via_kerl` (src/plugins/core/erlang.rs:563-566) the code matches on the tool request: anything of the form `ref:<git-ref>` hits `unimplemented!(\"erlang does not yet support refs\")` because kerl's `build-install` workflow only understands release versions like `OTP-27.3` or `27.3`. Notably, this panic fires late — after the source tarball is downloaded, checksum-verified, copied into kerl's archives, and after `file::remove_all(tv.install_path())` has already wiped any previous install at that path.","triggerScenarios":"Installing erlang via a ref request: `mise install erlang@ref:main`, `mise use erlang@ref:master`, `erlang = \"ref:somebranch\"` in mise.toml, or `mise exec erlang@ref:... -- ...`, in any situation that routes to the kerl source-build path (Linux, or precompiled assets unavailable for the platform/version, or erlang compile settings forcing source). Precompiled releases exist only for release tags, so refs almost always land here.","commonSituations":"Wanting a bleeding-edge OTP fix from a branch; copying a `ref:` convention used for other mise tools (git/backend tools support refs) and assuming erlang does; CI matrices pinning `erlang@ref:OTP-...` tags; a previous erlang install being silently removed by the `remove_all` right before the panic, leaving the tool version directory gone.","solutions":["Use a released version instead: `mise use erlang@28` (or an exact tag like `mise use erlang@27.3.4`) — kerl path fully supports release versions","If you need a specific git state, find the OTP release tag that contains it and install that tag instead of the raw ref","For a truly custom build: compile Erlang manually (kerl or ./configure && make), then point mise at it via `mise use erlang@path:/opt/erlang-custom` rather than a ref request","If this already fired and wiped your install, re-run the install with a released version to restore the tool directory"],"exampleFix":"# before (panics: erlang does not yet support refs)\nmise use erlang@ref:master\n# after\nmise use erlang@28\n# or point at a manual build:\nmise use erlang@path:/opt/erlang-otp-master","handlingStrategy":"validation","validationCode":"# reject ref: requests for erlang before mise wipes the install dir\ncheck_erlang_version() {\n  case \"$1\" in\n    erlang@ref:*|ref:*) echo \"erlang does not support ref: installs (mise)\" >&2; return 1 ;;\n    erlang@path:*|erlang@[0-9]*|erlang@OTP-*|erlang@latest) return 0 ;;\n    erlang@*) return 0 ;;\n    *) return 0 ;;\n  esac\n}\ncheck_erlang_version 'erlang@ref:master' || exit 1","typeGuard":"# rust: only release-like or path requests are safe for erlang\nfn is_safe_erlang_request(req: &str) -> bool {\n    let v = req.strip_prefix(\"erlang@\").unwrap_or(req);\n    !(v.starts_with(\"ref:\") || v.starts_with(\"branch:\") || v.starts_with(\"tag:\") || v.starts_with(\"rev:\"))\n}","tryCatchPattern":"# rust: catch the panic signal as an error path is not possible — unimplemented! aborts the task;\n# instead pre-check the ToolRequest before install and surface a real error:\nif matches!(tv.request, ToolRequest::Ref { .. }) {\n    return Err(eyre::eyre!(\"erlang does not support ref: requests; use a release version or path:\"));\n}","preventionTips":["Never write `erlang = \"ref:...\"` into mise.toml; ref support exists for git-based tools, not the kerl-built erlang core plugin","Note the failure is late: mise deletes the existing install dir before panicking, so a bad ref request can cost you the current install — validate first","Prefer exact OTP release tags or `path:` to a manual build for custom Erlang trees"],"tags":["mise","erlang","otp","ref","kerl","source-build","unimplemented"],"backgroundTag":"ref-version-unsupported","analyzedSha":"6bd4a54fadcdf3a6757cc44061a9528b48dd2ae7","analyzedAt":"2026-08-16T19:20:32.527Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}