github/copilot-sdk · error

decode elicitation schema property

Error message

decode elicitation schema property %q: property missing after conversion

What it means

The SDK decodes a UI elicitation (dialog) schema from the RPC wire format into its public schema type. After unmarshaling, it looks up the specific property by name in the converted schema's Properties map; this error means the requested property name was not present in the decoded schema even though JSON unmarshaling succeeded. It indicates the property name passed to the elicitation helper does not match any property the runtime actually sent, or the schema shape changed between SDK/runtime versions.

Solutions

  1. Print/log the elicitation schema and confirm the exact property key exists before requesting it
  2. Fix the property name argument to match the schema exactly (case-sensitive)
  3. Upgrade the SDK and the runtime/CLI together so the elicitation schema shape matches
  4. Guard with an existence check on schema.Properties[name] before use and handle absence gracefully

Example fix

// before
prop, err := decodeElicitationProperty(name, wrapperData)
// after
var rpcSchema rpc.UIElicitationSchema
_ = json.Unmarshal(wrapperData, &rpcSchema)
if _, ok := rpcSchema.Properties[name]; !ok {
    return nil, fmt.Errorf("unknown elicitation property %q", name)
}
prop, err := decodeElicitationProperty(name, wrapperData)
Defensive patterns

Strategy: validation

Validate before calling

var probe rpc.UIElicitationSchema
if err := json.Unmarshal(wrapperData, &probe); err == nil {
    if _, ok := probe.Properties[name]; !ok {
        return fmt.Errorf("elicitation property %q not in schema", name)
    }
}

Type guard

func hasProperty(s rpc.UIElicitationSchema, name string) bool {
    _, ok := s.Properties[name]
    return ok
}

Try / catch

prop, err := decodeElicitationProperty(name, data)
if err != nil {
    if strings.Contains(err.Error(), "property missing") {
        return handleMissingProperty(name) // graceful fallback
    }
    return err
}

Prevention

When it happens

Trigger: Calling a Session elicitation helper (e.g. Elicit/Confirm-family) with a property `name` argument whose key is absent from `rpc.UIElicitationSchema.Properties` after conversion of the runtime-provided schema JSON.

Common situations: Typo in the property name; the dialog schema was updated server-side (renamed/removed a field) while the client still asks for the old key; mismatched SDK and native runtime versions producing a differently-shaped schema.

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 github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/0a56676a7096b80a. Report an issue: GitHub.

Appendix: source

Thrown at go/session.go:1238

	}
	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)
	}

	var rpcSchema rpc.UIElicitationSchema
	if err := json.Unmarshal(wrapperData, &rpcSchema); err != nil {
		return nil, fmt.Errorf("decode elicitation schema property %q: %w", name, err)
	}
	rpcProperty, ok := rpcSchema.Properties[name]
	if !ok {
		return nil, fmt.Errorf("decode elicitation schema property %q: property missing after conversion", name)
	}
	return rpcProperty, nil
}

// Confirm shows a confirmation dialog and returns the user's boolean answer.
// Returns false if the user declines or cancels.
func (ui *SessionUI) Confirm(ctx context.Context, message string) (bool, error) {
	if err := ui.session.assertElicitation(); err != nil {
		return false, err
	}
	rpcResult, err := ui.session.RPC.UI.Elicitation(ctx, &rpc.UIElicitationRequest{
		Message: message,
		RequestedSchema: rpc.UIElicitationSchema{
			Type: rpc.UIElicitationSchemaTypeObject,
			Properties: map[string]rpc.UIElicitationSchemaProperty{
				"confirmed": &rpc.UIElicitationSchemaPropertyBoolean{
					Default: Bool(true),
				},

View on GitHub (pinned to cd8cf15dc3)