{"record":{"id":"eace03871c7b0da1","repo":"github/copilot-sdk","slug":"decode-elicitation-schema-property-q-w","errorCode":null,"errorMessage":"decode elicitation schema property %q: %w","messagePattern":"decode elicitation schema property %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/session.go","lineNumber":1234,"sourceCode":"\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)\n\t}\n\n\tvar rpcSchema rpc.UIElicitationSchema\n\tif err := json.Unmarshal(wrapperData, &rpcSchema); err != nil {\n\t\treturn nil, fmt.Errorf(\"decode elicitation schema property %q: %w\", name, err)\n\t}\n\trpcProperty, ok := rpcSchema.Properties[name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"decode elicitation schema property %q: property missing after conversion\", name)\n\t}\n\treturn rpcProperty, nil\n}\n\n// Confirm shows a confirmation dialog and returns the user's boolean answer.\n// Returns false if the user declines or cancels.\nfunc (ui *SessionUI) Confirm(ctx context.Context, message string) (bool, error) {\n\tif err := ui.session.assertElicitation(); err != nil {\n\t\treturn false, err\n\t}\n\trpcResult, err := ui.session.RPC.UI.Elicitation(ctx, &rpc.UIElicitationRequest{\n\t\tMessage: message,\n\t\tRequestedSchema: rpc.UIElicitationSchema{\n\t\t\tType: rpc.UIElicitationSchemaTypeObject,","sourceCodeStart":1216,"sourceCodeEnd":1252,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/session.go#L1216-L1252","documentation":"Once the wrapper schema is marshaled, it is unmarshaled into rpc.UIElicitationSchema to normalize the property. If that decode fails, or the property is missing afterwards (the follow-up 'property missing after conversion' variant), the library returns this error naming the property. It means the property definition could not be re-validated as a proper schema property object.","triggerScenarios":"A marshaled property definition decodes into something the rpc.UIElicitationSchema expects differently (e.g. wrong 'type' value, properties conflicting with the wrapper), causing json.Unmarshal of wrapperData to fail.","commonSituations":"Property definitions whose 'type' field collides with the wrapper's object type; values marshaling to non-object JSON (strings, arrays) that the rpc schema rejects; version mismatch between the local struct tags and rpc types.","solutions":["Check the wrapped json.Unmarshal error for the exact decode mismatch","Ensure the property definition marshals to a JSON object with a valid schema 'type'","Pass rpc.UIElicitationSchemaProperty directly to skip the marshal/decode round-trip","Validate the property against the rpc.UIElicitationSchemaProperty struct fields before calling"],"exampleFix":"// before\nprops := map[string]any{\"x\": []string{\"a\"}} // array, not schema object\n// after\nprops := map[string]any{\"x\": map[string]any{\"type\": \"string\", \"enum\": []string{\"a\"}}}","handlingStrategy":"validation","validationCode":"data, err := json.Marshal(property)\nif err != nil { return err }\nvar probe map[string]any\nif err := json.Unmarshal(data, &probe); err != nil {\n    return fmt.Errorf(\"property must decode to a schema object: %w\", err)\n}\nif _, ok := probe[\"type\"]; !ok {\n    return fmt.Errorf(\"property missing 'type'\")\n}","typeGuard":null,"tryCatchPattern":"res, err := ui.Elicitation(ctx, msg, schema)\nif err != nil && strings.Contains(err.Error(), \"decode elicitation schema property\") {\n    return fmt.Errorf(\"property is not a valid schema object: %w\", err)\n}","preventionTips":["Ensure each property marshals to a JSON object with a valid 'type'","Pass rpc.UIElicitationSchemaProperty directly to skip the round-trip","Keep property 'type' values valid for rpc.UIElicitationSchemaType"],"tags":["elicitation","schema","json"],"backgroundTag":"json-unmarshal-failed","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"}