larksuite/cli · error

has an unsupported boolean value

Error message

%s has an unsupported boolean value

What it means

The value is a proper boolean but not one of the booleans the schema's enum permits (e.g. enum: [false] while true was supplied). The type check passed, so this is a value-level rejection by validateJSONValueAgainstShape. It typically occurs on fields constrained to exactly one boolean value.

Solutions

  1. Set the boolean to the only value the schema allows (the message names the field; check `schema` for the enum)
  2. Remove the field from the request if the API owns its value
  3. If a previously working value now fails, refresh the CLI catalog/schema metadata
  4. Do not attempt workarounds like 0/1 — the field is strictly boolean

Example fix

// before
body := map[string]any{"shared": true} // enum only allows false
// after
body := map[string]any{} // omit the server-owned field
Defensive patterns

Strategy: validation

Validate before calling

func ensureBoolEnum(v bool, allowed []bool) error {
    if len(allowed) > 0 && !slices.Contains(allowed, v) {
        return fmt.Errorf("boolean %v not allowed; must be %v", v, allowed)
    }
    return nil
}

Type guard

func isAllowedBool(v any, allowed ...bool) bool {
    b, ok := v.(bool)
    return ok && (len(allowed) == 0 || slices.Contains(allowed, b))
}

Try / catch

if err := bind(field, true); err != nil {
    if strings.Contains(err.Error(), "unsupported boolean value") {
        return fmt.Errorf("field %s is fixed by the API; omit it or use the allowed value: %w", field, err)
    }
    return err
}

Prevention

When it happens

Trigger: Setting a boolean field whose constraint.Enum is [false] (or [true]) to the opposite value; supplying `true` to a read-only/constant boolean flag in a nested object validated by valueCompatibleWithShape.

Common situations: Trying to flip a server-controlled boolean (e.g. a synthetic or derived field); copying request examples that set a constant flag; schema updates that pinned a previously free boolean.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at shortcuts/common/typed_binder.go:435

		}
		length := len([]rune(text))
		if constraint.MinLength != nil && length < *constraint.MinLength {
			return fmt.Errorf("%s must contain at least %d characters", path, *constraint.MinLength)
		}
		if constraint.MaxLength != nil && length > *constraint.MaxLength {
			return fmt.Errorf("%s must contain at most %d characters", path, *constraint.MaxLength)
		}
		if len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, text) {
			return fmt.Errorf("%s must be one of: %s", path, strings.Join(constraint.Enum, ", "))
		}
		return nil
	case typedBooleanShape:
		boolean, ok := value.(bool)
		if !ok {
			return fmt.Errorf("%s must be a boolean", path)
		}
		if len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, boolean) {
			return fmt.Errorf("%s has an unsupported boolean value", path)
		}
		return nil
	case typedIntegerShape:
		number, ok := validationInteger(value)
		if !ok {
			return fmt.Errorf("%s must be an integer", path)
		}
		if constraint.Minimum != nil && number < *constraint.Minimum {
			return fmt.Errorf("%s must be at least %d", path, *constraint.Minimum)
		}
		if constraint.Maximum != nil && number > *constraint.Maximum {
			return fmt.Errorf("%s must be at most %d", path, *constraint.Maximum)
		}
		if len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, number) {
			return fmt.Errorf("%s has an unsupported integer value", path)
		}
		return nil
	case typedNumberShape:

View on GitHub (pinned to 7fd6ef3c07)