{"record":{"id":"e57857cd4e7455ac","repo":"jdx/mise","slug":"stdin-reads-the-value-from-stdin-do-not-provide","errorCode":null,"errorMessage":"--stdin reads the value from stdin; do not provide a value with KEY=VALUE syntax","messagePattern":"--stdin reads the value from stdin; do not provide a value with KEY=VALUE syntax","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/set.rs","lineNumber":192,"sourceCode":"                    if ev.value.is_none() {\n                        let prompt_msg = format!(\"Enter value for {}\", ev.key);\n                        let value = Input::new(&prompt_msg)\n                            .password(self.age_encrypt) // Mask input if encrypting\n                            .theme(&theme)\n                            .run()?;\n                        ev.value = Some(value);\n                    }\n                }\n            }\n\n            // Read value from stdin if requested\n            if self.stdin {\n                if env_vars.len() != 1 {\n                    bail!(\"--stdin requires exactly one environment variable key\");\n                }\n                let ev = &mut env_vars[0];\n                if ev.value.is_some() {\n                    bail!(\n                        \"--stdin reads the value from stdin; do not provide a value with KEY=VALUE syntax\"\n                    );\n                }\n                let mut value = String::new();\n                std::io::stdin().read_to_string(&mut value)?;\n                // Strip a single trailing newline (matches `gh secret set` behavior)\n                if value.ends_with(\"\\r\\n\") {\n                    value.truncate(value.len() - 2);\n                } else if value.ends_with('\\n') {\n                    value.truncate(value.len() - 1);\n                }\n                ev.value = Some(value);\n            }\n\n            // Handle age encryption if requested\n            if self.age_encrypt {\n                Settings::get().ensure_experimental(\"age encryption\")?;\n                // Collect recipients once before the loop to avoid repeated I/O","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/set.rs#L174-L210","documentation":"When --stdin is used, the value must come exclusively from standard input. If the user also supplies KEY=VALUE syntax, the value field is already populated, which is contradictory, so mise bails before reading stdin.","triggerScenarios":"`mise set --stdin KEY=value` — providing an inline value together with the --stdin flag.","commonSituations":"Copy-pasting a normal `mise set KEY=value` command and appending --stdin; scripted commands mixing both forms.","solutions":["Drop the =value part: `echo value | mise set --stdin KEY`","Drop --stdin if you want the inline value: `mise set KEY=value`"],"exampleFix":"// before\nmise set --stdin API_KEY=abc123   # error\n// after\nmise set API_KEY=abc123   # or: echo abc123 | mise set --stdin API_KEY","handlingStrategy":"validation","validationCode":"[[ \"$1\" != *=* ]] || { echo 'with --stdin pass only KEY, not KEY=VALUE'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never mix inline values with --stdin","Choose one form per invocation: pipe or inline"],"tags":["cli","env","stdin"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}