larksuite/cli · error
L1: outputSchema.type = %q, want "object"
Error message
L1: outputSchema.type = %q, want "object"
What it means
lintEnvelope's L1 check requires outputSchema, when present, to declare type exactly "object". The error is appended when an envelope declares a non-object output schema. This normalizes all tool outputs to JSON objects for downstream consumers.
Source
Thrown at internal/schema/lint.go:50
// ---- L1: structural ----
if env.Name == "" {
errs = append(errs, errors.New("L1: name must not be empty"))
}
if env.InputSchema == nil {
errs = append(errs, errors.New("L1: inputSchema must not be nil"))
} else {
if env.InputSchema.Type != "object" {
errs = append(errs, fmt.Errorf("L1: inputSchema.type = %q, want \"object\"", env.InputSchema.Type))
}
if env.InputSchema.Properties == nil {
errs = append(errs, errors.New("L1: inputSchema.properties must not be nil"))
}
}
if env.OutputSchema == nil {
errs = append(errs, errors.New("L1: outputSchema must not be nil"))
} else {
if env.OutputSchema.Type != "object" {
errs = append(errs, fmt.Errorf("L1: outputSchema.type = %q, want \"object\"", env.OutputSchema.Type))
}
}
if env.Meta == nil {
errs = append(errs, errors.New("L1: _meta must not be nil"))
// Cannot continue meta-dependent checks
return errs
}
if env.Meta.EnvelopeVersion != "1.0" {
errs = append(errs, fmt.Errorf("L1: _meta.envelope_version = %q, want \"1.0\"", env.Meta.EnvelopeVersion))
}
// L1: validate every Property type recursively
if env.InputSchema != nil && env.InputSchema.Properties != nil {
validatePropertyTypes(env.InputSchema.Properties, &errs)
}
if env.OutputSchema != nil && env.OutputSchema.Properties != nil {
validatePropertyTypes(env.OutputSchema.Properties, &errs)
}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Set outputSchema.type to "object" and nest the actual payload under properties (e.g. a data wrapper).
- Fix typos in the type value ("objec" -> "object").
- Re-run the lint to confirm the envelope passes L1.
Example fix
// before
"outputSchema": { "type": "array" }
// after
"outputSchema": { "type": "object", "properties": { "data": { "type": "array" } } } Defensive patterns
Strategy: validation
Validate before calling
func outputSchemaIsObject(env map[string]any) bool {
s, ok := env["outputSchema"].(map[string]any)
return ok && s["type"] == "object"
} Type guard
func hasObjectOutputSchema(env *Envelope) bool { return env.OutputSchema != nil && env.OutputSchema.Type == "object" } Try / catch
errs := lintEnvelope(env)
for _, e := range errs {
if strings.Contains(e.Error(), "outputSchema.type") {
// fix envelope: set type "object" and wrap payloads in a data property
}
} Prevention
- Wrap list/scalar outputs in an object with a data property.
- Copy type values from a validated template to avoid typos.
- Run the envelope lint before merging envelope changes.
When it happens
Trigger: Linting an envelope whose outputSchema.type is e.g. "string", "array", or a typo like "objec" instead of "object".
Common situations: Describing a tool that returns a list and using array as the root type instead of wrapping it in an object; hand-editing schema JSON and mistyping the type; a generator producing bare scalar output schemas.
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
- L1: inputSchema.type = %q, want "object"
- L1: _meta.envelope_version = %q, want "1.0"
- L2: required key %q not found in properties
- L3: _meta.danger=%v inconsistent with risk=%q
- expected boolean
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/84a51b1b67226d03.
Report an issue: GitHub.