Skip to content

Cannot call custom commands from plugin #16974

Closed

Description

@frxstrem

Bug report form

  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.

Describe the bug

When attempting to call EngineInterface::call_decl on a custom command in a plugin, the following error occurs:

Error: nu::shell::error

  × Internal error: can't run custom command with 'run', use block_id

How to reproduce

I have a plugin with the following for a command call-foo.

fn run(
    &self,
    plugin: &Self::Plugin,
    engine: &EngineInterface,
    call: &EvaluatedCall,
    input: PipelineData,
) -> Result<PipelineData, LabeledError> {
    let decl_id = engine.find_decl("foo")?;
    eprintln!("decl_id = {decl_id:?}");
    match decl_id {
        Some(decl_id) => engine
            .call_decl(decl_id, EvaluatedCall::new(call.head), input, true, false)
            .map_err(Into::into),
        None => Ok(PipelineData::empty()),
    }
}

If foo is defined in another plugin, for example on that simply outputs FOO (or if it is replaced with a built-in command), the following happens:

> call-foo
decl_id = Some(DeclId(477))
FOO

If foo is instead defined as a custom command, the error occors:

> def foo [] { 'FOO' }
> call-foo
decl_id = Some(DeclId(592))
Error: nu::shell::error

  × Internal error: can't run custom command with 'run', use block_id

Expected behavior

Calling find_decl followed by call_decl on a custom command should just run the custom command.

Configuration

key value
version 0.108.0
major 0
minor 108
patch 0
branch
commit_hash da141be
build_os linux-x86_64
build_target x86_64-unknown-linux-musl
rust_version rustc 1.88.0 (6b00bc388 2025-06-23)
rust_channel 1.88.0-x86_64-unknown-linux-gnu
cargo_version cargo 1.88.0 (873a06493 2025-05-10)
build_time 2025-10-15 12:05:23 +00:00
build_rust_channel release
allocator standard
features default, network, plugin, rustls-tls, sqlite, static-link-openssl, trash-support
installed_plugins
experimental_options example=false, reorder-cell-paths=true, pipefail=false, enforce-runtime-annotations=false

Activity

  1. added
    status:needs-triage
    on Nov 3, 2025
  2. added
    A:plugins
    on Nov 5, 2025
  3. added this to the v0.117.0 milestone on Oct 28, 2026
  4. added a commit that references this issue on Oct 28, 2026
    85fba6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:pluginsstatus:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions