{"record":{"id":"bc214ccb1f17ce5e","repo":"github/copilot-sdk","slug":"elicitation-schema-property-q-is-nil","errorCode":null,"errorMessage":"elicitation schema property %q is nil","messagePattern":"elicitation schema property %q is nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/session.go","lineNumber":1211,"sourceCode":"\t\tfor name, property := range schema.Properties {\n\t\t\trpcProperty, err := toRPCUIElicitationSchemaProperty(name, property)\n\t\t\tif err != nil {\n\t\t\t\treturn rpc.UIElicitationSchema{}, err\n\t\t\t}\n\t\t\tproperties[name] = rpcProperty\n\t\t}\n\t}\n\n\treturn rpc.UIElicitationSchema{\n\t\tProperties: properties,\n\t\tRequired:   append([]string(nil), schema.Required...),\n\t\tType:       rpc.UIElicitationSchemaTypeObject,\n\t}, nil\n}\n\nfunc toRPCUIElicitationSchemaProperty(name string, property any) (rpc.UIElicitationSchemaProperty, error) {\n\tif property == nil {\n\t\treturn nil, fmt.Errorf(\"elicitation schema property %q is nil\", name)\n\t}\n\tif rpcProperty, ok := property.(rpc.UIElicitationSchemaProperty); ok {\n\t\treturn rpcProperty, nil\n\t}\n\n\tdata, err := json.Marshal(property)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshal elicitation schema property %q: %w\", name, err)\n\t}\n\twrapperData, err := json.Marshal(struct {\n\t\tProperties map[string]json.RawMessage  `json:\"properties\"`\n\t\tType       rpc.UIElicitationSchemaType `json:\"type\"`\n\t}{\n\t\tProperties: map[string]json.RawMessage{name: data},\n\t\tType:       rpc.UIElicitationSchemaTypeObject,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshal elicitation schema wrapper for property %q: %w\", name, err)","sourceCodeStart":1193,"sourceCodeEnd":1229,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/session.go#L1193-L1229","documentation":"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.","triggerScenarios":"Passing ElicitationSchema{Properties: map[string]any{\"name\": nil}} to Elicitation or related UI methods, producing a nil entry for key \"name\".","commonSituations":"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.","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"],"exampleFix":"// before\nprops := map[string]any{\"age\": nil}\n// after\nprops := map[string]any{\"age\": map[string]any{\"type\": \"number\"}}","handlingStrategy":"validation","validationCode":"for name, p := range schema.Properties {\n    if p == nil {\n        return fmt.Errorf(\"schema property %q is nil\", name)\n    }\n}","typeGuard":"func hasNilProperties(props map[string]any) bool {\n    for _, p := range props { if p == nil { return true } }\n    return false\n}","tryCatchPattern":"res, err := ui.Elicitation(ctx, msg, schema)\nif err != nil && strings.Contains(err.Error(), \"schema property\") && strings.Contains(err.Error(), \"is nil\") {\n    return fmt.Errorf(\"fix schema: %w\", err)\n}","preventionTips":["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"],"tags":["elicitation","schema","validation"],"backgroundTag":"null-argument","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}