larksuite/cli · error

bridged DryRun returned %T, expected *common.DryRunAPI

Error message

bridged DryRun returned %T, expected *common.DryRunAPI

What it means

Guard in the command-bridge DryRun adapter: a host plugin's bridged DryRun hook returned a value whose type is not *common.DryRunAPI. Bridge implementers must return that concrete preview type.

Source

Thrown at shortcuts/common/typed_external.go:90

	return newArgs(), nil
}

func adaptBridgeHooks(hooks commandbridge.Hooks) compiledHooks {
	adapted := compiledHooks{
		newArgs:   hooks.NewArgs,
		normalize: hooks.Normalize,
		validate:  hooks.Validate,
		renderers: hooks.Renderers,
	}
	if hooks.DryRun != nil {
		adapted.dryRun = func(ctx context.Context, runtime typedRuntimeContext, args any) (*DryRunAPI, error) {
			value, err := hooks.DryRun(ctx, runtime, args)
			if err != nil || value == nil {
				return nil, err
			}
			preview, ok := value.(*DryRunAPI)
			if !ok {
				return nil, fmt.Errorf("bridged DryRun returned %T, expected *common.DryRunAPI", value)
			}
			return preview, nil
		}
	}
	if hooks.Execute != nil {
		adapted.execute = func(ctx context.Context, runtime typedRuntimeContext, args any) (compiledResult, error) {
			result, err := hooks.Execute(ctx, runtime, args)
			converted := compiledResult{data: result.Data, outcome: typedOutcomeKind(result.Outcome)}
			if result.Pagination != nil {
				converted.meta = &typedResultMeta{Pagination: &typedResultPaginationMeta{
					Complete: result.Pagination.Complete,
					Pages:    result.Pagination.Pages, Items: result.Pagination.Items,
					NextToken: result.Pagination.NextToken,
				}}
			}
			return converted, err
		}
	}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Return *common.DryRunAPI (or nil) from the bridged DryRun hook
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at shortcuts/common/typed_external.go:90 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/66b2385a37991b6c. Report an issue: GitHub.