ory/kratos · error · herodot.ErrMisconfiguration

The address type for sending OTP codes is not supported.

Error message

The address type for sending OTP codes is not supported.

What it means

NewCodeChannel received a channel string that matched neither 'email' nor 'sms' in the exact-case switch, so it wrapped ErrInvalidCodeAddressType with the unknown-case error. The input at fault is the configured/requested code delivery channel; only email and SMS code channels exist.

Solutions

  1. Set the code channel to exactly 'email' or 'sms' (case-sensitive)
  2. Check for stray whitespace or alternate spellings in the submitted channel value
  3. Update clients that send custom channel strings to use the supported ones
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at identity/credentials_code.go:53 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ory/kratos@b86338da04 (2026-09-07). Data as JSON: /api/errors/3edc82e76cd138b4. Report an issue: GitHub.

Appendix: source

Thrown at identity/credentials_code.go:53

		return nil
	default:
		return errors.Errorf("cannot scan %T into CodeChannel", src)
	}
}

const (
	CodeChannelEmail CodeChannel = AddressTypeEmail
	CodeChannelSMS   CodeChannel = AddressTypeSMS
)

func NewCodeChannel(value string) (CodeChannel, error) {
	switch f := stringsx.SwitchExact(value); {
	case f.AddCase(string(CodeChannelEmail)):
		return CodeChannelEmail, nil
	case f.AddCase(string(CodeChannelSMS)):
		return CodeChannelSMS, nil
	default:
		return "", errors.Wrap(ErrInvalidCodeAddressType(), f.ToUnknownCaseErr().Error())
	}
}

// CredentialsCode represents a one time login/registration code
//
// swagger:model identityCredentialsCode
type CredentialsCode struct {
	Addresses []CredentialsCodeAddress `json:"addresses"`
}

// swagger:model identityCredentialsCodeAddress
type CredentialsCodeAddress struct {
	// The type of the address for this code
	Channel CodeChannel `json:"channel"`

	// The address for this code
	Address string `json:"address"`
}

View on GitHub (pinned to b86338da04)