From 6fc05f9172b879c676c8b8d9d05b38ac8ff10ed0 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Mon, 19 Jan 2026 09:31:38 -0600 Subject: [PATCH 1/2] fix: preserve {{ version }} in tool options during config load Tool options with {{ version }} are install-time templates that should be preserved at config load time for later rendering when the version is known. This fixes an error when loading config with HTTP backend tools (like claude) that have {{ version }} in their URL templates from registry.toml. The fix adds a placeholder value for 'version' in the Tera context that outputs the literal '{{ version }}' string, preserving it for install-time template rendering. Fixes #7748 --- src/config/config_file/mise_toml.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config/config_file/mise_toml.rs b/src/config/config_file/mise_toml.rs index f7a99c2717..b289911211 100644 --- a/src/config/config_file/mise_toml.rs +++ b/src/config/config_file/mise_toml.rs @@ -655,8 +655,12 @@ impl ConfigFile for MiseToml { for tool in &tvp.0 { let version = self.parse_template_with_context(&context, &tool.tt.to_string())?; let tvr = if let Some(mut options) = tool.options.clone() { + // Add placeholder for version since it's not available at config load time + // This preserves {{ version }} in the output for install-time rendering + let mut opts_context = context.clone(); + opts_context.insert("version", "{{ version }}"); for v in options.opts.values_mut() { - *v = self.parse_template_with_context(&context, v)?; + *v = self.parse_template_with_context(&opts_context, v)?; } let mut ba = ba.clone(); // Start with cached options but filter out install-time-only options From 25dc4124a52587e90ceae306f40acf4bac352e65 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Mon, 19 Jan 2026 09:49:37 -0600 Subject: [PATCH 2/2] test(e2e): add test for Tera {{ version }} templating in HTTP backend This tests the fix for https://github.com/jdx/mise/discussions/7748 which caused "Variable 'version' not found in context" errors when using {{ version }} with spaces in HTTP backend URLs. Co-Authored-By: Claude Opus 4.5 --- e2e/backend/test_http | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/e2e/backend/test_http b/e2e/backend/test_http index b43ffaeb11..b9c5495798 100644 --- a/e2e/backend/test_http +++ b/e2e/backend/test_http @@ -140,3 +140,15 @@ EOF mise uninstall --all && mise install mise env assert_contains "mise x -- hello-world" "hello world" + +# Test HTTP backend with Tera {{ version }} templating syntax (with spaces) +# This tests the fix for https://github.com/jdx/mise/discussions/7748 +# Note: postinstall uses literal version since it's a shell command executed directly +cat <<'EOF' >mise.toml +[tools] +"http:hello-tera" = { version = "1.0.0", url = "https://mise.jdx.dev/test-fixtures/hello-world-{{ version }}.tar.gz", bin_path = "hello-world-{{ version }}/bin", postinstall = "chmod +x $MISE_TOOL_INSTALL_PATH/hello-world-1.0.0/bin/hello-world" } +EOF + +mise uninstall --all && mise install +mise env +assert_contains "mise x -- hello-world" "hello world"