jdx/mise · error

--stdin reads the value from stdin; do not provide a value w

Error message

--stdin reads the value from stdin; do not provide a value with KEY=VALUE syntax

What it means

`--stdin` and an inline value are mutually exclusive sources for the same variable. If the single key was parsed as KEY=VALUE (ev.value.is_some()), mise bails instead of silently choosing a winner, so the stdin content is never consumed or lost.

Source

Thrown at src/cli/set.rs:183

                    if ev.value.is_none() {
                        let prompt_msg = format!("Enter value for {}", ev.key);
                        let value = Input::new(&prompt_msg)
                            .password(self.age_encrypt) // Mask input if encrypting
                            .theme(&theme)
                            .run()?;
                        ev.value = Some(value);
                    }
                }
            }

            // Read value from stdin if requested
            if self.stdin {
                if env_vars.len() != 1 {
                    bail!("--stdin requires exactly one environment variable key");
                }
                let ev = &mut env_vars[0];
                if ev.value.is_some() {
                    bail!(
                        "--stdin reads the value from stdin; do not provide a value with KEY=VALUE syntax"
                    );
                }
                let mut value = String::new();
                std::io::stdin().read_to_string(&mut value)?;
                // Strip a single trailing newline (matches `gh secret set` behavior)
                if value.ends_with("\r\n") {
                    value.truncate(value.len() - 2);
                } else if value.ends_with('\n') {
                    value.truncate(value.len() - 1);
                }
                ev.value = Some(value);
            }

            // Handle age encryption if requested
            if self.age_encrypt {
                Settings::get().ensure_experimental("age encryption")?;
                // Collect recipients once before the loop to avoid repeated I/O

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Drop the inline value and let stdin supply it: `echo bar | mise set --stdin FOO`
  2. Or drop --stdin and set directly: `mise set FOO=bar`

Example fix

# before
echo bar | mise set --stdin FOO=bar   # --stdin reads the value from stdin; do not provide a value with KEY=VALUE syntax

# after
echo bar | mise set --stdin FOO
Defensive patterns

Strategy: validation

Validate before calling

# reject KEY=VALUE arguments before invoking --stdin
case "$key" in
  *=*) echo 'pass a bare KEY with --stdin; the value comes from stdin' >&2; exit 2;;
esac
printf '%s' "$value" | mise set --stdin "$key"

Type guard

is_bare_key() { case "$1" in *=*) return 1;; *) return 0;; esac; }

Try / catch

No retry value: catch the error, strip the inline value from the command, and rerun `printf '%s' value | mise set --stdin KEY`.

Prevention

When it happens

Trigger: Running `echo val | mise set --stdin FOO=bar` — one KEY=VALUE argument combined with --stdin.

Common situations: Copy-pasting a previous `mise set FOO=bar` command and adding --stdin; scripts templating both the value and the pipe.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/e57857cd4e7455ac. Report an issue: GitHub.