larksuite/cli · error

unsupported public shape %T

Error message

unsupported public shape %T

What it means

lowerAuthoringShape only accepts the documented public shape variants (String, Boolean, Integer, Number, Null, Const, Array, Object, OneOf); any other concrete type passed as a command.ValueShape hits the default branch. The error includes the offending Go type via %T so the developer can identify what was wrongly supplied.

Source

Thrown at shortcuts/common/typed_shape.go:135

		if err != nil {
			return nil, err
		}
		return typedObjectShape{
			Fields: fields, AdditionalProperties: value.AdditionalProperties,
			AdditionalPropertiesShape: additional,
		}, nil
	case command.OneOfShape:
		variants := make([]typedValueShape, len(value.Variants))
		for index, variant := range value.Variants {
			lowered, err := lowerAuthoringShape(variant)
			if err != nil {
				return nil, fmt.Errorf("variant %d: %w", index, err)
			}
			variants[index] = lowered
		}
		return typedOneOfShape{Variants: variants}, nil
	default:
		return nil, fmt.Errorf("unsupported public shape %T", shape)
	}
}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Read the %T in the error and replace that value with one of the supported command.*Shape types.
  2. Never pass pointers to shape types — pass concrete values (command.StringShape{}, not &command.StringShape{}).
  3. If shapes come from decoded data, add an explicit conversion step mapping decoded values to supported shape types before compiling.

Example fix

// before
Shape: &command.StringShape{} // pointer: dynamic type *command.StringShape is unsupported
// after
Shape: command.StringShape{}
Defensive patterns

Strategy: type-guard

Validate before calling

if !isSupportedShape(myShape) {
    return fmt.Errorf("unsupported shape %T; use a documented command.*Shape value", myShape)
}

Type guard

func isSupportedShape(s command.ValueShape) bool {
    switch s.(type) {
    case nil, command.StringShape, command.BooleanShape, command.IntegerShape,
        command.NumberShape, command.NullShape, command.ConstShape,
        command.ArrayShape, command.ObjectShape, command.OneOfShape:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Passing a custom struct, pointer (*command.StringShape), map, or type from another package as Shape / Items / AdditionalPropertiesShape / Variants / field.Shape in a Typed input definition; a typed-nil interface (e.g. (*command.StringShape)(nil)) also lands here since its dynamic type is unmatched.

Common situations: Copy-pasting shape code from a different CLI version where shape types changed; building shapes dynamically with reflection or JSON-decoding them into map[string]interface{}; wrapping shapes in helper types.

Related errors


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