larksuite/cli · error
field %q: %w
Error message
field %q: %w
What it means
lowerAuthoringShape converts public command.ValueShape authoring types into internal lowered shapes. When lowering an ObjectShape, each field's shape is lowered recursively; this wrapper wraps any child failure with the field name so the author can locate the bad field. The inner error is usually 'unsupported public shape %T' from a nested field.
Source
Thrown at shortcuts/common/typed_shape.go:110
}, nil
case command.NullShape:
return typedNullShape{}, nil
case command.ConstShape:
return typedConstShape{Value: cloneJSONValue(value.Value)}, nil
case command.ArrayShape:
items, err := lowerAuthoringShape(value.Items)
if err != nil {
return nil, err
}
return typedArrayShape{
Items: items, MinItems: cloneScalarPointer(value.MinItems), MaxItems: cloneScalarPointer(value.MaxItems),
}, nil
case command.ObjectShape:
fields := make([]typedValueField, len(value.Fields))
for index, field := range value.Fields {
fieldShape, err := lowerAuthoringShape(field.Shape)
if err != nil {
return nil, fmt.Errorf("field %q: %w", field.Name, err)
}
fields[index] = typedValueField{
Name: field.Name, Description: field.Description, Required: field.Required, Shape: fieldShape,
}
}
additional, err := lowerAuthoringShape(value.AdditionalPropertiesShape)
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 {View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Read the full wrapped error chain: 'field "x": ... unsupported public shape <T>' tells you the offending field and type.
- Replace the offending field's Shape value with a supported constructor (command.StringShape{}, command.ObjectShape{...}, etc.).
- Check for nil interface carrying a typed nil pointer; use the concrete zero value of the shape type instead.
Example fix
// before
fields: []command.DataField{{ Name: "owner", Shape: myCustomShape{} }} // unsupported type
// after
fields: []command.DataField{{ Name: "owner", Shape: command.StringShape{Format: "open_id"} }} Defensive patterns
Strategy: validation
Validate before calling
// Validate shapes before compiling the input definition:
func checkShape(s command.ValueShape) error {
switch t := s.(type) {
case nil, command.StringShape, command.BooleanShape, command.IntegerShape,
command.NumberShape, command.NullShape, command.ConstShape,
command.ArrayShape, command.ObjectShape, command.OneOfShape:
return nil
default:
return fmt.Errorf("unsupported shape %T", t)
}
} 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
- Only use documented command.*Shape constructors; never hand-roll structs implementing ValueShape.
- Avoid pointers to shapes — pass concrete values.
- Compile the input definition in a unit test so lowering errors fail fast.
When it happens
Trigger: Declaring a Typed input object whose field.Shape is nil-typed-but-non-nil interface, or a custom type that does not implement one of the supported command.ValueShape variants (String/Boolean/Integer/Number/Null/Const/Array/Object/OneOf).
Common situations: Hand-rolling a shape struct instead of using the command package's shape constructors; passing a *T pointer or map literal where a concrete shape type is expected; copy-paste from older shortcut code using a removed shape type.
Related errors
- variant %d: %w
- unsupported public shape %T
- Args must be a non-pointer struct, got %s
- L1: inputSchema must not be nil
- L1: inputSchema.properties must not be nil
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/70e4673312720930.
Report an issue: GitHub.