larksuite/cli · error
schema token %s does not accept a value
Error message
schema token %s does not accept a value
What it means
Thrown by parseSchemaTag when the nullable or nonnullable token is given a value (e.g. nullable=true). Both are mutually exclusive bare markers; a value is not accepted, and declaring both is also rejected immediately after.
Source
Thrown at shortcuts/common/typed_compile_args.go:425
key, value, hasValue := strings.Cut(token, "=")
if _, duplicate := seen[key]; duplicate {
return result, fmt.Errorf("schema token %q is duplicated", key)
}
seen[key] = struct{}{}
switch key {
case "required":
if hasValue {
return result, fmt.Errorf("schema token required does not accept a value")
}
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}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Write bare `nullable` or `nonnullable` with no value
- Use `nonnullable` instead of `nullable=false`
- Ensure only one of nullable/nonnullable appears in the tag
Example fix
// before Name string `cli:"--name;schema:\"required;nullable=true\""` // after Name string `cli:"--name;schema:\"required;nullable\""`
Defensive patterns
Strategy: validation
Validate before calling
if (key == "nullable" || key == "nonnullable") && strings.Contains(token, "=") {
return fmt.Errorf("%s must be a bare token", key)
}
if strings.Contains(tag, "nullable") && strings.Contains(tag, "nonnullable") {
return fmt.Errorf("declare only one of nullable/nonnullable")
} Prevention
- Use bare nullable/nonnullable tokens
- Never write nullable=true/false
- Declare at most one nullability marker per tag
When it happens
Trigger: A tag like `schema:"required;nullable=true"`; the case "nullable","nonnullable" branch checks hasValue and formats the offending key into the message.
Common situations: Applying key=value style uniformly; copying boolean attribute syntax from OpenAPI/JSON-Schema into the tag; generators emitting nullable=false for non-nullable fields.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- schema token required does not accept a value
- schema token optional does not accept a value
- schema tag must declare exactly one of required or optional
- schema contains blank or untrimmed token %q
- schema token %q is duplicated
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/12a130198aa0355a.
Report an issue: GitHub.