Skip to content

env vars defined earlier fail to render in subsequent env var templates #3755

Closed
@bartsmykla

Description

Describe the bug
According to the documentation (https://mise.jdx.dev/environments/#using-env-vars-in-other-env-vars), it should be possible to use env vars defined earlier in subsequent env vars. However, when I attempt the following:

[env]
A = "a"
B = "{{ env.B }}"

I receive the following error:

mise ERROR failed to parse template: '{{ env.B }}'
mise ERROR Failed to render '__tera_one_off'
mise ERROR Variable `env.B` not found in context while rendering '__tera_one_off'
mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information

This prevents me from using a variable from a script in a PATH definition. For example:

[env]
_.source = ".mise/env.sh"
_.path = [
    "{{ env.__GENERATE_TOOLS_DIR }}",
]

To Reproduce

  1. Define environment variables as shown in the example above.
  2. Run mise and observe the error output.

Expected behavior
I expected the environment variables defined earlier to be usable in subsequent env vars without causing errors.

mise doctor output

version: 2024.12.15 macos-arm64 (0d37f33 2024-12-19)
activated: yes
shims_on_path: no

build_info:
Target: aarch64-apple-darwin
Features: DEFAULT, NATIVE_TLS, OPENSSL
Built: Thu, 19 Dec 2024 18:51:18 +0000
Rust Version: rustc 1.83.0 (90b35a623 2024-11-26)
Profile: release

shell:
/opt/homebrew/bin/fish
fish, version 3.7.1

dirs:
cache: ~/Library/Caches/mise
config: ~/.config/mise
data: ~/.local/share/mise
shims: ~/.local/share/mise/shims
state: ~/.local/state/mise

config_files:
~/.config/mise/config.toml
~/project/mise.toml

backends:
aqua
asdf
cargo
core
gem
go
npm
pipx
spm
ubi
vfox

plugins:
clang-format           git@github.com:higebu/asdf-llvm.git#c527fd9
kube-controller-tools  git@github.com:jimmidyson/asdf-kube-controller-tools.git#37526dc
oapi-codegen           git@github.com:dylanrayboss/asdf-oapi-codegen.git#a988840

toolset:
aqua:GoogleContainerTools/container-structure-test@1.19.3
aqua:etcd-io/etcd@3.5.17
aqua:golangci/golangci-lint@1.62.0
aqua:helm/helm@3.16.4
aqua:jqlang/jq@1.7.1
aqua:koalaman/shellcheck@0.10.0
aqua:kubernetes-sigs/kubebuilder@4.3.1
aqua:kubernetes/kubectl@1.32.0
aqua:norwoodj/helm-docs@1.11.0
aqua:protocolbuffers/protobuf-go/protoc-gen-go@1.28.1
aqua:protocolbuffers/protobuf/protoc@3.20.0
aqua:stackrox/kube-linter@0.6.5
asdf:kube-controller-tools@0.16.5
asdf:oapi-codegen@2.4.1
core:go@1.23.4
go:github.com/envoyproxy/protoc-gen-validate@v1.1.0
go:github.com/google/osv-scanner/cmd/osv-scanner@1.9.1
go:github.com/onsi/ginkgo/v2/ginkgo@2.22.0
go:github.com/pubg/protoc-gen-jsonschema@0.6.2
go:google.golang.org/grpc/cmd/protoc-gen-go-grpc@1.1.0
ubi:bartsmykla/clang-tools-static-binaries@foo
ubi:hadolint/hadolint@2.12.0
ubi:jdx/usage@1.7.2
ubi:k3d-io/k3d@5.7.5
ubi:kubernetes-sigs/kind@0.26.0
ubi:mikefarah/yq@4.30.8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions