larksuite/cli · error

L1: inputSchema.properties must not be nil

Error message

L1: inputSchema.properties must not be nil

What it means

This L1 structural lint error fires when an envelope declares an InputSchema but leaves its Properties map nil. The lint contract requires every object-type input schema to enumerate its properties explicitly, so a nil map is treated as an incomplete schema rather than 'no properties'.

Source

Thrown at internal/schema/lint.go:43

}

// lintEnvelope runs L1-L3 checks and returns a list of errors. Empty slice
// means the envelope is compliant.
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))
	}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Initialize InputSchema.Properties to a non-nil map, adding entries for each accepted parameter.
  2. If the command truly takes no parameters, set Properties to an empty non-nil map: map[string]*Property{}.
  3. Add a unit test constructing the envelope so TestAllEnvelopesPass-style lint coverage catches regressions.

Example fix

// before
InputSchema: &Schema{Type: "object"}
// after
InputSchema: &Schema{Type: "object", Properties: map[string]*Property{}}
Defensive patterns

Strategy: validation

Validate before calling

func hasProperties(s *Schema) bool { return s != nil && s.Type == "object" && s.Properties != nil }

Type guard

if env.InputSchema != nil && env.InputSchema.Properties == nil {
    // handle: properties map missing
}

Try / catch

if err := lintEnvelope(env); err != nil {
    // scan error strings for "inputSchema.properties" and fix the schema
}

Prevention

When it happens

Trigger: Linting an envelope whose InputSchema is non-nil with Type "object" but Properties == nil, e.g. &Schema{Type: "object"} without a properties map.

Common situations: Copy-pasting minimal schema structs from docs; constructing schemas programmatically and forgetting to initialize the map; JSON round-trips where "properties" was omitted and decoded into a nil map.

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


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