larksuite/cli · error

plugin

Error message

plugin %q: %v

What it means

Message for the panic raised by Builder.MustBuild when Build() fails: a misconfigured plugin (invalid name, capabilities, actions, rules, etc.) must crash at init time rather than be silently registered. The underlying Build error is embedded.

Solutions

  1. Fix the Builder configuration error reported after the colon
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extension/platform/builder.go:230 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/a6b56a59fc4c58be. Report an issue: GitHub.

Appendix: source

Thrown at extension/platform/builder.go:230

		caps:          b.caps,
		actions:       b.actions,
		rules:         b.rules,
		skillsOverlay: b.skillsOverlay,
	}, nil
}

// MustBuild panics if Build() would return an error. Designed for
// init():
//
//	func init() { platform.Register(platform.NewPlugin(...).MustBuild()) }
//
// A panic in init runs before the framework's recover guard is
// installed and will crash the binary. That is the intended
// behaviour: a misconfigured plugin must NOT be silently registered.
func (b *Builder) MustBuild() Plugin {
	p, err := b.Build()
	if err != nil {
		panic(fmt.Sprintf("plugin %q: %v", b.name, err))
	}
	return p
}

// validateHookName checks the grammar and uniqueness; returns false
// when the name was rejected (caller skips the action).
func (b *Builder) validateHookName(hookName, kind string) bool {
	if !pluginNamePattern.MatchString(hookName) {
		b.errs = append(b.errs, fmt.Errorf(
			"%s %q: hookName must match ^[a-z0-9][a-z0-9-]*$", kind, hookName))
		return false
	}
	if b.hookNames[hookName] {
		b.errs = append(b.errs, fmt.Errorf(
			"%s %q: hookName already used in this plugin", kind, hookName))
		return false
	}
	b.hookNames[hookName] = true

View on GitHub (pinned to 7fd6ef3c07)