larksuite/cli · error

schema default requires a JSON literal

Error message

schema default requires a JSON literal

What it means

Schema tag parse guard: the default token was given without a JSON literal value, so there is nothing to use as the field default.

Source

Thrown at shortcuts/common/typed_compile_args.go:434

			}
			result.required = true
		case "optional":
			if hasValue {
				return result, fmt.Errorf("schema token optional does not accept a value")
			}
			result.optional = true
		case "nullable", "nonnullable":
			if hasValue {
				return result, fmt.Errorf("schema token %s does not accept a value", key)
			}
			if result.nullable != nil {
				return result, fmt.Errorf("schema cannot declare both nullable and nonnullable")
			}
			v := key == "nullable"
			result.nullable = &v
		case "default":
			if !hasValue || value == "" {
				return result, fmt.Errorf("schema default requires a JSON literal")
			}
			if !input {
				return result, fmt.Errorf("Data field cannot declare default")
			}
			var decoded any
			if err := json.Unmarshal([]byte(value), &decoded); err != nil {
				return result, fmt.Errorf("schema default is not valid JSON: %w", err)
			}
			result.defaultValue = typedInputDefault{Set: true, Value: decoded}
		case "enum":
			if !hasValue || value == "" {
				return result, fmt.Errorf("schema enum requires at least one value")
			}
			result.enum = strings.Split(value, "|")
		case "format":
			if !hasValue || value == "" {
				return result, fmt.Errorf("schema format requires a name")
			}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Provide a JSON literal, e.g. default:"true" or default:"[]"
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/common/typed_compile_args.go:434 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/d791e21fc9fec0b0. Report an issue: GitHub.