github/copilot-sdk · error
failed to set auto tier
Error message
failed to set auto tier: %w
What it means
Session.SetAutoTier changes the Auto routing preference via s.RPC.Model.SwitchAutoTier without switching models. This error wraps any failure of that RPC — an invalid AutoTier value, a runtime that doesn't support auto-tier routing, or a transport failure.
Solutions
- Confirm the AutoTier value is one supported by the running runtime version
- Inspect the wrapped error for the runtime's rejection reason
- Upgrade the runtime/CLI if auto-tier support was added later
- Fall back to SetModel with an explicit model when auto-tier is unavailable
Example fix
// before
result, err := session.SetAutoTier(ctx, &AutoTierHigh)
// after
result, err := session.SetAutoTier(ctx, &AutoTierHigh)
if err != nil {
log.Printf("set auto tier failed, falling back to explicit model: %v", err)
err = session.SetModel(ctx, defaultModel, defaultProvider)
} Defensive patterns
Strategy: fallback
Validate before calling
if autoTier != nil && *autoTier != "high" && *autoTier != "low" {
return errors.New("unsupported auto tier value")
} Try / catch
result, err := session.SetAutoTier(ctx, tier)
if err != nil {
log.Printf("auto tier unavailable: %v — using explicit model", err)
return session.SetModel(ctx, fallbackModel, fallbackProvider)
} Prevention
- Only use AutoTier values the target runtime understands
- Provide an explicit-model fallback path
- Gate auto-tier usage on runtime version detection
When it happens
Trigger: Calling Session.SetAutoTier(ctx, autoTier) when `Model.SwitchAutoTier` rejects the request (unsupported tier value, feature unavailable in the running runtime) or the transport fails.
Common situations: Passing an AutoTier constant not recognized by an older runtime; invoking auto-tier on a deployment where the routing feature is disabled; stale session after reconnect.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- failed to set model
- decode elicitation schema property
- failed to abort session
- failed to disconnect session
- failed to get events
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/ac2bcc8229f6de84.
Report an issue: GitHub.
Appendix: source
Thrown at go/session.go:2041
// Only the most recent request survives: issuing a new request replaces any earlier one
// that has not yet been claimed by a turn.
//
// Pass nil to return to the provider's default Auto routing.
//
// Experimental: SetAutoTier is part of an experimental Auto routing surface and
// may change or be removed.
//
// Example:
//
// tier := copilot.AutoTierIntelligence
// result, err := session.SetAutoTier(context.Background(), &tier)
// if err != nil {
// log.Printf("Failed to set auto tier: %v", err)
// }
func (s *Session) SetAutoTier(ctx context.Context, autoTier *AutoTier) (*rpc.ModelSwitchAutoTierResult, error) {
result, err := s.RPC.Model.SwitchAutoTier(ctx, &rpc.ModelSwitchAutoTierRequest{AutoTier: autoTier})
if err != nil {
return nil, fmt.Errorf("failed to set auto tier: %w", err)
}
return result, nil
}
type LogOptions struct {
// Level sets the log severity. Valid values are [rpc.SessionLogLevelInfo] (default),
// [rpc.SessionLogLevelWarning], and [rpc.SessionLogLevelError].
Level rpc.SessionLogLevel
// Ephemeral marks the message as transient so it is not persisted
// to the session event log on disk. When nil the server decides the
// default; set to a non-nil value to explicitly control persistence.
Ephemeral *bool
}
// Log sends a log message to the session timeline.
// The message appears in the session event stream and is visible to SDK consumers
// and (for non-ephemeral messages) persisted to the session event log on disk.View on GitHub (pinned to cd8cf15dc3)