larksuite/cli · error
Output.Data.Shape and Output.Data.Overrides are mutually exc
Error message
Output.Data.Shape and Output.Data.Overrides are mutually exclusive
What it means
Compile-time guard in compileData: a definition supplies both an explicit Output.Data.Shape and Data.Overrides. Overrides mutate a compiled struct shape, so they cannot coexist with a fully explicit shape.
Source
Thrown at shortcuts/common/typed_compile_data.go:25
import (
"encoding"
"encoding/json"
"fmt"
"math"
"reflect"
"strconv"
"strings"
)
var (
jsonRawMessageType = reflect.TypeFor[json.RawMessage]()
jsonMarshalerType = reflect.TypeFor[json.Marshaler]()
textMarshalerType = reflect.TypeFor[encoding.TextMarshaler]()
)
func compileData(dataType reflect.Type, definition typedDataDefinition) (typedValueShape, error) {
if definition.Shape != nil && len(definition.Overrides) > 0 {
return nil, fmt.Errorf("Output.Data.Shape and Output.Data.Overrides are mutually exclusive")
}
if definition.Shape != nil {
shape, err := lowerAuthoringShape(definition.Shape)
if err != nil {
return nil, err
}
if err := validateShape(shape, "Output.Data.Shape"); err != nil {
return nil, err
}
return shape, nil
}
if dataType.Kind() == reflect.Interface && dataType.NumMethod() == 0 {
if len(definition.Overrides) > 0 {
return nil, fmt.Errorf("Output.Data.Overrides require struct Data")
}
return anyJSONShape{}, nil
}
if dataType.Kind() != reflect.Struct {View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Keep either Output.Data.Shape or Output.Data.Overrides, not both
Defensive patterns
Strategy: validation
Validate before calling
func (d typedDataDefinition) validate() error {
if d.Shape != nil && len(d.Overrides) > 0 {
return errors.New("Shape and Overrides are mutually exclusive")
}
return nil
} Prevention
- Choose one authoring style per output definition and document it
- When migrating to explicit Shape, delete old Overrides in the same change
- Add a lint/test asserting definitions never set both fields
When it happens
Trigger: Thrown at shortcuts/common/typed_compile_data.go:25 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/fa296ac731bf5205.
Report an issue: GitHub.