jdx/mise · error

expected block edit

Error message

expected block edit

What it means

Match-panic in the request_for_bashrc_activate unit test: the built ShellActivationRequest's edit op was not EditOp::Block with an inline BlockSource. It fires when the bashrc activation request builder produces a different EditOp (e.g. a line edit or external source) for ShellActivationTarget::Bashrc in Activate mode.

Source

Thrown at src/system/shell_activation.rs:224

            ShellActivationTarget::Bashrc,
            ShellActivationMode::Activate,
        );
        assert_eq!(request.target, ShellActivationTarget::Bashrc);
        assert_eq!(request.shell, ShellActivationShell::Bash);
        assert_eq!(request.mode, ShellActivationMode::Activate);
        assert_eq!(request.edit.path_raw, "~/.bashrc");
        assert_eq!(request.edit.id, "activate");
        match request.edit.op {
            EditOp::Block {
                source: BlockSource::Inline(block),
                template,
                comment,
            } => {
                assert_eq!(block, r#"eval "$(mise activate bash)""#);
                assert!(!template);
                assert_eq!(comment, "#");
            }
            _ => panic!("expected block edit"),
        }
    }

    #[test]
    fn request_for_zprofile_shims() {
        let request = ShellActivationRequest::new(
            ShellActivationTarget::Zprofile,
            ShellActivationMode::Shims,
        );
        assert_eq!(request.edit.path_raw, "~/.zprofile");
        match request.edit.op {
            EditOp::Block {
                source: BlockSource::Inline(block),
                ..
            } => assert_eq!(block, r#"eval "$(mise activate zsh --shims)""#),
            _ => panic!("expected block edit"),
        }
    }

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Make the bashrc activate request builder emit EditOp::Block with BlockSource::Inline containing the mise activation snippet
  2. Confirm the block id ('activate'), comment, and template fields match the test's assertions
  3. Re-run the shell_activation tests after changing the request builder
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/system/shell_activation.rs:224 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/5bb27a44457011a1. Report an issue: GitHub.