larksuite/cli · critical

%s uses unsupported shape %T

Error message

%s uses unsupported shape %T

What it means

The shape definition itself has a kind the validator does not implement — this is an internal/programming error, not bad user input. The compiled command's shape reached the default branch of the type switch in validateJSONValueAgainstShape, meaning a shape type exists without a validation case.

Source

Thrown at shortcuts/common/typed_binder.go:518

			field, exists := fields[name]
			if !exists {
				if !constraint.AdditionalProperties {
					return fmt.Errorf("%s contains unknown field %q", path, name)
				}
				if constraint.AdditionalPropertiesShape != nil {
					if err := validateJSONValueAgainstShape(item, constraint.AdditionalPropertiesShape, path+"."+name); err != nil {
						return err
					}
				}
				continue
			}
			if err := validateJSONValueAgainstShape(item, field.Shape, path+"."+name); err != nil {
				return err
			}
		}
		return nil
	default:
		return fmt.Errorf("%s uses unsupported shape %T", path, shape)
	}
}

func decodeJSONValidationValue(encoded []byte) (any, error) {
	decoder := json.NewDecoder(bytes.NewReader(encoded))
	decoder.UseNumber()
	var value any
	if err := decoder.Decode(&value); err != nil {
		return nil, err
	}
	return value, nil
}

func validationInteger(value any) (int64, bool) {
	switch number := value.(type) {
	case json.Number:
		parsed, err := strconv.ParseInt(number.String(), 10, 64)
		return parsed, err == nil

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Upgrade lark-cli to a version whose binder supports the shape in use (version skew is the most common cause).
  2. If you develop the shortcut/plugin, add a case for the new shape kind in validateJSONValueAgainstShape.
  3. Report the exact path and shape type (%T in the message) as a bug if it occurs with stock commands.

Example fix

// before (binder source)
default:
    return fmt.Errorf("%s uses unsupported shape %T", path, shape)

// after (add the missing case)
case typedNewShape:
    // validation for the new shape kind
    ...
    return nil
Defensive patterns

Strategy: try-catch

Validate before calling

if lark-cli --version | grep -qv "$MIN_VERSION"; then
  echo "upgrade lark-cli: binary/metadata version skew possible" >&2
fi

Type guard

func isUnsupportedShapeErr(err error) bool {
    return err != nil && strings.Contains(err.Error(), "uses unsupported shape")
}

Try / catch

out, err := cmd.CombinedOutput()
if isUnsupportedShapeErr(errors.New(string(out))) {
    // report bug / upgrade binary; no input change will fix it
    fmt.Fprintln(os.Stderr, "unsupported shape — upgrade lark-cli or report bug:", string(out))
    os.Exit(3)
}

Prevention

When it happens

Trigger: A developer adds a new typed*Shape kind to the binder but forgets a case in validateJSONValueAgainstShape; a mismatched/older binary compiled against newer shape metadata; extension code constructing a custom shape the built-in validator does not know.

Common situations: Version skew between the CLI binary and embedded service metadata; third-party extensions registering unsupported shapes; incomplete refactors of the typed-binder package.

Related errors


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