Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mise run fails when adding env directives #2504

Closed
mdesouky opened this issue Aug 27, 2024 · 2 comments
Closed

mise run fails when adding env directives #2504

mdesouky opened this issue Aug 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mdesouky
Copy link

Describe the bug
When adding a python env line to [env] block in .mise.toml file as follows:

[env]
_.file = 'server/.env'
_.python.venv = { path = ".venv", create = true } # create the venv if it doesn't exist

and trying to run tasks I get the following error

The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: JoinPathsError { inner: JoinPathsError }
Location: src/path_env.rs:50

Full trace

❯ RUST_BACKTRACE=full mise run install
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: JoinPathsError { inner: JoinPathsError }
Location: src/path_env.rs:50

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 9 frames hidden ⋮                               
  10: mise::toolset::Toolset::env_with_path::ha352fc7531460682
      at <unknown source file>:<unknown line>
  11: mise::cli::run::Run::run::h58120052c1c0853f
      at <unknown source file>:<unknown line>
  12: mise::cli::Cli::run::hf6cb0a1443c80811
      at <unknown source file>:<unknown line>
  13: mise::main::h4b059410b007a228
      at <unknown source file>:<unknown line>
  14: std::sys_common::backtrace::__rust_begin_short_backtrace::h59d757c488a0c1a5
      at <unknown source file>:<unknown line>
  15: std::rt::lang_start::{{closure}}::hc34123bf95d8d56d
      at <unknown source file>:<unknown line>
  16: std::panicking::try::h0cf3a98f51cee1e9
      at <unknown source file>:<unknown line>
  17: std::rt::lang_start_internal::h07dd9d9140cc1a1e
      at <unknown source file>:<unknown line>
  18: _main<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

To Reproduce

  • Add the following line under the [env] block

_.python.venv = { path = ".venv", create = true }

Expected behavior
Mise tasks should run as normal which happens when you remove that line

mise doctor output

❯ mise doctor     
version: 2024.7.4 macos-arm64 (2024-07-19)
activated: yes
shims_on_path: yes

build_info: 
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Fri, 19 Jul 2024 02:39:35 +0000
  Rust Version: rustc 1.79.0 (129f3b996 2024-06-10) (Homebrew)
  Profile: release

shell: 
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin23.0)

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

config_files: 
  ~/.config/mise/config.toml
  ~/.mise.toml
  ~/git/logbooks/.mise.toml

backends: 
  cargo
  core
  go
  npm
  pipx
  spm
  ubi

plugins: 
  aws-iam-authenticator  https://github.com/zekker6/asdf-aws-iam-authenticator#fd1866a
  awscli                 https://github.com/MetricMike/asdf-awscli.git#ac99537
  bun                    (core)
  deno                   (core)
  erlang                 (core)
  go                     (core)
  java                   (core)
  kubectl                https://github.com/asdf-community/asdf-kubectl.git#cbe6df4
  kubectx                https://gitlab.com/wt0f/asdf-kubectx.git#8c0b4aa
  node                   (core)
  pnpm                   https://github.com/jonathanmorley/asdf-pnpm.git#305baff
  poetry                 https://github.com/mise-plugins/mise-poetry.git#431c335
  python                 (core)
  ruby                   (core)
  sops                   https://github.com/mise-plugins/mise-sops#d746770
  terraform              https://github.com/asdf-community/asdf-hashicorp.git#f1602b6
  terragrunt             https://github.com/ohmer/asdf-terragrunt.git#4a6651a
  tflint                 https://github.com/skyzyx/asdf-tflint.git#37e7eb9
  trivy                  https://github.com/zufardhiyaulhaq/asdf-trivy.git#537a22a
  zig                    (core)

toolset: 
  poetry@1.8.3          
  node@16.20.2          
  python@3.11.9         
  pnpm@8.15.9           
  aws-iam-authenticator@0.6.11  
  kubectx@0.9.5         
  kubectl@1.28.1        
  awscli@2.13.14        

env_vars: 
  MISE_SHELL=zsh

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = true
  python_default_packages_file = "/Users/mohamed/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
1 problem found:

1. new mise version 2024.8.13 available, currently on 2024.7.4

Additional context
debug output

❯ mise run install --debug
[DEBUG] ARGS: /opt/homebrew/bin/mise run install --debug
[DEBUG] Config {
    Config Files: [
        "~/git/logbooks/.mise.toml",
        "~/.mise.toml",
        "~/.config/mise/config.toml",
    ],
}
[DEBUG] Toolset (1.376375ms): poetry@latest, node@16, python@3.11, pnpm@8, aws-iam-authenticator@0.6.11, kubectx@0.9.5, kubectl@1.28.1, awscli@2.13.14
[DEBUG] glob: "/Users/mohamed/git/logbooks/server/.env"
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: JoinPathsError { inner: JoinPathsError }
Location: src/path_env.rs:50

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Trace output

❯ mise run install --trace
[DEBUG] (1) mise::cli: [src/cli/mod.rs:217] ARGS: /opt/homebrew/bin/mise run install --trace
[TRACE] (1) mise::config: [src/config/mod.rs:69] Settings: Settings {
    activate_aggressive: false,
    all_compile: false,
    always_keep_download: false,
    always_keep_install: false,
    asdf_compat: false,
    cargo_binstall: true,
    color: true,
    disable_default_shorthands: false,
    disable_tools: {},
    experimental: true,
    go_default_packages_file: "~/.default-go-packages",
    go_download_mirror: "https://dl.google.com/go",
    go_repo: "https://github.com/golang/go",
    go_set_gobin: None,
    go_set_gopath: false,
    go_set_goroot: true,
    go_skip_checksum: false,
    http_timeout: 30,
    jobs: 4,
    legacy_version_file: true,
    legacy_version_file_disable_tools: {},
    libgit2: true,
    node_compile: false,
    not_found_auto_install: true,
    paranoid: false,
    plugin_autoupdate_last_check_duration: "7d",
    python_compile: Some(
        true,
    ),
    python_default_packages_file: Some(
        "/Users/mohamed/.default-python-packages",
    ),
    python_patch_url: None,
    python_patches_directory: None,
    python_precompiled_arch: None,
    python_precompiled_os: None,
    python_pyenv_repo: "https://github.com/pyenv/pyenv.git",
    raw: false,
    shorthands_file: None,
    status: SettingsStatus {
        missing_tools: IfOtherVersionsInstalled,
        show_env: false,
        show_tools: false,
    },
    task_output: None,
    trusted_config_paths: {},
    quiet: false,
    verbose: true,
    yes: false,
    ci: false,
    cd: None,
    debug: true,
    env_file: None,
    trace: true,
    log_level: "trace",
    python_venv_auto_create: false,
}
[TRACE] (3) mise::plugins::mise_plugin_toml: [src/plugins/mise_plugin_toml.rs:28] parsing: /Users/mohamed/.local/share/mise/plugins/poetry/mise.plugin.toml
[TRACE] (6) mise::plugins::mise_plugin_toml: [src/plugins/mise_plugin_toml.rs:28] parsing: /Users/mohamed/.local/share/mise/plugins/sops/mise.plugin.toml
[TRACE] (6) mise::file: [src/file.rs:129] cat ~/.local/share/mise/plugins/sops/mise.plugin.toml
[TRACE] (3) mise::file: [src/file.rs:129] cat ~/.local/share/mise/plugins/poetry/mise.plugin.toml
[TRACE] (4) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/tflint/.mise.backend.json
[TRACE] (8) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/awscli/.mise.backend.json
[TRACE] (6) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/pnpm/.mise.backend.json
[TRACE] (3) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/poetry/.mise.backend.json
[TRACE] (5) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/python/.mise.backend.json
[TRACE] (2) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/terraform/.mise.backend.json
[TRACE] (9) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/terragrunt/.mise.backend.json
[TRACE] (7) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/node/.mise.backend.json
[TRACE] (3) mise::plugins::mise_plugin_toml: [src/plugins/mise_plugin_toml.rs:28] parsing: /Users/mohamed/.local/share/mise/plugins/poetry/mise.plugin.toml
[TRACE] (3) mise::file: [src/file.rs:129] cat ~/.local/share/mise/plugins/poetry/mise.plugin.toml
[TRACE] (2) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/aws-iam-authenticator/.mise.backend.json
[TRACE] (9) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/kubectx/.mise.backend.json
[TRACE] (3) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/kubectl/.mise.backend.json
[TRACE] (8) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/sops/.mise.backend.json
[TRACE] (8) mise::plugins::mise_plugin_toml: [src/plugins/mise_plugin_toml.rs:28] parsing: /Users/mohamed/.local/share/mise/plugins/sops/mise.plugin.toml
[TRACE] (8) mise::file: [src/file.rs:129] cat ~/.local/share/mise/plugins/sops/mise.plugin.toml
[TRACE] (5) mise::file: [src/file.rs:129] cat ~/.local/share/mise/installs/trivy/.mise.backend.json
[TRACE] (8) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/terraform/legacy_filenames-a1faa.msgpack.z
[TRACE] (2) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/terragrunt/legacy_filenames-a1faa.msgpack.z
[TRACE] (6) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/poetry/legacy_filenames-a1faa.msgpack.z
[TRACE] (3) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:86] parsing: ~/.mise.toml
[TRACE] (3) mise::file: [src/file.rs:129] cat ~/.mise.toml
[TRACE] (4) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:86] parsing: ~/.config/mise/config.toml
[TRACE] (4) mise::file: [src/file.rs:129] cat ~/.config/mise/config.toml
[TRACE] (2) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:86] parsing: ~/git/logbooks/.mise.toml
[TRACE] (2) mise::file: [src/file.rs:129] cat ~/git/logbooks/.mise.toml
[TRACE] (4) mise::file: [src/file.rs:129] cat ~/.config/mise/config.toml
[TRACE] (2) mise::file: [src/file.rs:129] cat ~/git/logbooks/.mise.toml
[TRACE] (3) mise::file: [src/file.rs:129] cat ~/.mise.toml
[TRACE] (4) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:96] [settings]
experimental = true
python_compile = true

[tools]
python = "3.12.0"

[TRACE] (3) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:96] [tools]
python = "3.12.1"
node = "18"
pnpm = "8"
aws-iam-authenticator = "0.6.11"
kubectx = "0.9.5"
kubectl = "1.28.1"
awscli = "2.13.14"

[TRACE] (2) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:96] [tools]
poetry = { version = 'latest', pyproject = 'server/pyproject.toml' }
node = '16'
python = { version='3.11', virtualenv='.venv' }

[env]
_.file = 'server/.env'
_.python.venv = { path = ".venv", create = true } # create the venv if it doesn't exist

[tasks."install:tools"]
description = "Sets up tools"
run = ["mise install"]


[tasks."install:python:pip"]
description = "Upgrade pip to latest"
run = ["python -m pip install --upgrade pip"]
depends = ["install:tools"]

[tasks."install:python:precommit"]
description = "Sets up pre_commit"
run = ["pip install pre-commit", "mise reshim", "pre-commit install"]
depends = ["install:python:pip"]

[tasks."install:python:requirements"]
description = "Sets up pre_commit"
run = ["poetry install -C server"]
depends = ["install:python:pip"]

[tasks.install]
description = "Installs everything"
depends = ["install:*"]


[DEBUG] (1) mise::config: [src/config/mod.rs:90] Config {
    Config Files: [
        "~/git/logbooks/.mise.toml",
        "~/.mise.toml",
        "~/.config/mise/config.toml",
    ],
}
[TRACE] (1) mise::config: [src/config/mod.rs:235] loading task [install:tools] mise install from ~/git/logbooks/.mise.toml
[TRACE] (1) mise::config: [src/config/mod.rs:235] loading task [install:python:requirements] poetry install -C server from ~/git/logbooks/.mise.toml
[TRACE] (1) mise::config: [src/config/mod.rs:235] loading task [install:python:precommit] pip install pre-commit from ~/git/logbooks/.mise.toml
[TRACE] (1) mise::config: [src/config/mod.rs:235] loading task [install:python:pip] python -m pip install --upgrade pip from ~/git/logbooks/.mise.toml
[TRACE] (1) mise::config: [src/config/mod.rs:235] loading task [install] from ~/git/logbooks/.mise.toml
[DEBUG] (1) mise::toolset::builder: [src/toolset/builder.rs:48] Toolset (2.628625ms): poetry@latest, node@16, python@3.11, pnpm@8, aws-iam-authenticator@0.6.11, kubectx@0.9.5, kubectl@1.28.1, awscli@2.13.14
[DEBUG] (1) xx::file: [/Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/xx-1.1.5/src/file.rs:212] glob: "/Users/mohamed/git/logbooks/server/.env"
[TRACE] (1) mise::config::env_directive: [src/config/env_directive.rs:164] python venv: .venv create=true
[TRACE] (2) mise::backend::asdf: [src/backend/asdf.rs:856] cache key element: {% if project_root %}
    {{ project_root | canonicalize }}
  {% endif %} -> /Users/mohamed/git/logbooks
[TRACE] (2) mise::backend::asdf: [src/backend/asdf.rs:856] cache key element: {% if opts.pyproject %}
    {{ opts.pyproject }}
  {% endif %} -> server/pyproject.toml
[TRACE] (2) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/poetry/1.8.3/exec_env/533c65f7f2-3a4016d2f4-a1faa.msgpack.z
[TRACE] (4) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/pnpm/8.15.9/list_bin_paths-a1faa.msgpack.z
[TRACE] (2) mise::backend::asdf: [src/backend/asdf.rs:856] cache key element: {% if project_root %}
    {{ project_root | canonicalize }}
  {% endif %} -> /Users/mohamed/git/logbooks
[TRACE] (5) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/awscli/2.13.14/list_bin_paths-a1faa.msgpack.z
[TRACE] (6) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/kubectx/0.9.5/list_bin_paths-a1faa.msgpack.z
[TRACE] (3) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/aws-iam-authenticator/0.6.11/list_bin_paths-a1faa.msgpack.z
[TRACE] (7) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/kubectl/1.28.1/list_bin_paths-a1faa.msgpack.z
[TRACE] (2) mise::backend::asdf: [src/backend/asdf.rs:856] cache key element: {% if opts.pyproject %}
    {{ opts.pyproject }}
  {% endif %} -> server/pyproject.toml
[TRACE] (2) mise::cache: [src/cache.rs:87] reading ~/Library/Caches/mise/poetry/1.8.3/list_bin_paths/533c65f7f2-3a4016d2f4-a1faa.msgpack.z
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: JoinPathsError { inner: JoinPathsError }
Location: src/path_env.rs:50

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
@mdesouky mdesouky added the bug Something isn't working label Aug 27, 2024
@mcallaway
Copy link
Contributor

mcallaway commented Aug 27, 2024

I've addressed this bug in #2511

@mdesouky
Copy link
Author

thanks @mcallaway

@jdx jdx closed this as completed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@jdx @mcallaway @mdesouky and others