larksuite/cli · error
L1: outputSchema must not be nil
Error message
L1: outputSchema must not be nil
What it means
lintEnvelope validates both directions of an envelope's schema contract; this L1 error indicates the OutputSchema field is nil. Every envelope must declare an object-typed output schema describing its result shape, so a missing output schema fails the structural lint.
Source
Thrown at internal/schema/lint.go:47
func lintEnvelope(env Envelope) []error {
var errs []error
// ---- 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)
}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Set OutputSchema to a non-nil Schema with Type "object" describing the envelope's result fields.
- Mirror the input-schema pattern used by neighboring envelopes in the same registry.
- Run the envelope lint suite to verify all envelopes in the registry now pass L1.
Example fix
// before
env := Envelope{Name: "send.message", InputSchema: in}
// after
env := Envelope{Name: "send.message", InputSchema: in, OutputSchema: &Schema{Type: "object", Properties: resultProps}} Defensive patterns
Strategy: validation
Validate before calling
func validateOutputSchema(env *Envelope) error {
if env.OutputSchema == nil {
return errors.New("envelope must declare a non-nil OutputSchema")
}
return nil
} Type guard
if env.OutputSchema == nil {
// handle: output schema missing
} Try / catch
if err := lintEnvelope(env); err != nil {
// look for "outputSchema must not be nil" and add the schema
} Prevention
- Define input and output schemas side by side in the same struct literal.
- Keep a registry test that lints every envelope on every build.
- Copy full envelope templates, not partial ones.
When it happens
Trigger: Registering or linting an Envelope with OutputSchema unset (nil), typically when the author assumed output shape need not be declared.
Common situations: New envelopes authored quickly without result documentation; refactors that split schema definitions and drop the output half; test fixtures built with only InputSchema populated.
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 must not be nil
- L1: inputSchema.properties must not be nil
- L1: _meta must not be nil
- L3: _meta.access_tokens must not be empty
- %s is nil
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/c0bde2d6949d166f.
Report an issue: GitHub.