中文
← Errors

F_SYSTEM_NO_MATCHING_HANDLER

No matching handler

A command has handlers, but the current invocation matches no path or flag and no default handler exists.

Updated 2 weeks ago

Reproduction

Invoking this major command without --help leaves no method to run:

src/root.command.ts
import { CommandMajor, Container, Handler } from 'func'

@CommandMajor()
class RootCommand {
  @Handler({ flag: 'help' })
  help() {}
}

new Container([RootCommand], { argv: [] }).run()

How to fix it

Add one default handler, or ensure every valid invocation selects a declared flag or path:

src/root.command.ts
class RootCommand {
  @Handler({ flag: 'help' })
  help() {}

  @Handler()
  run() {}
}

new Container([RootCommand], { argv: [] }).run()