github/copilot-sdk · error
elicitation schema property
Error message
elicitation schema property %q is nil
What it means
Elicitation schemas are maps of property name to property definition. When converting a Go map-based ElicitationSchema into the rpc schema, a property entry that is nil cannot represent a valid JSON schema property, so the library rejects it with this error naming the property key. It enforces that every schema property carries an actual definition.
Solutions
- Ensure every entry in the schema Properties map is a non-nil property definition
- Check for nil values before calling the UI method and skip or fill them
- Construct properties via typed structs or rpc.UIElicitationSchemaProperty to guarantee non-nil
- Initialize the property map fully before passing it to Elicitation
Example fix
// before
props := map[string]any{"age": nil}
// after
props := map[string]any{"age": map[string]any{"type": "number"}} Defensive patterns
Strategy: validation
Validate before calling
for name, p := range schema.Properties {
if p == nil {
return fmt.Errorf("schema property %q is nil", name)
}
} Type guard
func hasNilProperties(props map[string]any) bool {
for _, p := range props { if p == nil { return true } }
return false
} Try / catch
res, err := ui.Elicitation(ctx, msg, schema)
if err != nil && strings.Contains(err.Error(), "schema property") && strings.Contains(err.Error(), "is nil") {
return fmt.Errorf("fix schema: %w", err)
} Prevention
- Never insert nil into schema property maps
- Build properties from typed definitions, not bare any maps
- Validate schemas in unit tests before invoking UI methods
When it happens
Trigger: Passing ElicitationSchema{Properties: map[string]any{"name": nil}} to Elicitation or related UI methods, producing a nil entry for key "name".
Common situations: Building schemas dynamically where a variable holding the property definition was never assigned; copying schema maps and dropping values; JSON round-trips that turned omitted definitions into nil.
Related errors
- marshal elicitation schema property
- marshal elicitation schema wrapper for property
- decode elicitation schema property
- decode elicitation schema property
- sessionFs.initialCwd is required
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/bc214ccb1f17ce5e.
Report an issue: GitHub.
Appendix: source
Thrown at go/session.go:1211
for name, property := range schema.Properties {
rpcProperty, err := toRPCUIElicitationSchemaProperty(name, property)
if err != nil {
return rpc.UIElicitationSchema{}, err
}
properties[name] = rpcProperty
}
}
return rpc.UIElicitationSchema{
Properties: properties,
Required: append([]string(nil), schema.Required...),
Type: rpc.UIElicitationSchemaTypeObject,
}, nil
}
func toRPCUIElicitationSchemaProperty(name string, property any) (rpc.UIElicitationSchemaProperty, error) {
if property == nil {
return nil, fmt.Errorf("elicitation schema property %q is nil", name)
}
if rpcProperty, ok := property.(rpc.UIElicitationSchemaProperty); ok {
return rpcProperty, nil
}
data, err := json.Marshal(property)
if err != nil {
return nil, fmt.Errorf("marshal elicitation schema property %q: %w", name, err)
}
wrapperData, err := json.Marshal(struct {
Properties map[string]json.RawMessage `json:"properties"`
Type rpc.UIElicitationSchemaType `json:"type"`
}{
Properties: map[string]json.RawMessage{name: data},
Type: rpc.UIElicitationSchemaTypeObject,
})
if err != nil {
return nil, fmt.Errorf("marshal elicitation schema wrapper for property %q: %w", name, err)View on GitHub (pinned to cd8cf15dc3)