FiloSottile/age · error

identity encodings not supported

Error message

identity encodings not supported

What it means

RecipientV1 was asked to treat an identity string as a recipient, but the plugin's IdAsRecipient callback is nil — the plugin cannot convert its identity format into a recipient. The library rejects the conversion rather than guessing.

Source

Thrown at plugin/plugin.go:269

		if p.recipient == nil {
			return p.recipientError(i, fmt.Errorf("recipient encodings not supported"))
		}
		r, err := p.recipient(data)
		if err != nil {
			return p.recipientError(i, err)
		}
		recipients = append(recipients, r)
	}
	for i, s := range identityStrings {
		name, data, err := ParseIdentity(s)
		if err != nil {
			return p.identityError(i, err)
		}
		if name != p.name {
			return p.identityError(i, fmt.Errorf("unsupported plugin name: %q", name))
		}
		if p.idAsRecipient == nil {
			return p.identityError(i, fmt.Errorf("identity encodings not supported"))
		}
		r, err := p.idAsRecipient(data)
		if err != nil {
			return p.identityError(i, err)
		}
		identities = append(identities, r)
	}

	// Technically labels should be per-file key, but the client-side protocol
	// extension shipped like this, and it doesn't feel worth making a v2.
	var labels []string

	stanzas := make([][]*age.Stanza, len(fileKeys))
	for i, fk := range fileKeys {
		for j, r := range recipients {
			ss, ll, err := wrapWithLabels(r, fk)
			if p.broken {
				return 2

View on GitHub (pinned to b74dce4cdb)

Solutions

  1. Set the Plugin.IdAsRecipient callback if the plugin should support identities as recipients
  2. Use the plugin's recipient form instead of the identity when encrypting
  3. Upgrade the plugin to a version that supports identity-as-recipient conversion

Example fix

// before
plugin.New(name, newRecipient, nil)
// after
plugin.New(name, newRecipient, func(data []byte) (age.Recipient, error) { return idAsRecipient(data) })
Defensive patterns

Strategy: validation

Validate before calling

// Before encrypting with an identity-as-recipient:
if pluginIDAsRecipientUnsupported { // determined from plugin capabilities
    return errors.New("plugin does not support identities as recipients")
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "identity encodings not supported") {
        // fall back to using the plugin's recipient form
    }
}

Prevention

When it happens

Trigger: An identity string (not a recipient string) is passed where IdAsRecipient support is required, but the Plugin was constructed with IdAsRecipient nil; the plugin author never implemented identity-as-recipient conversion.

Common situations: Passing an identity file/argument to an encrypt flow via a plugin that only supports explicit recipients; using an older plugin version that lacks IdAsRecipient support.

Related errors


AI-assisted analysis of FiloSottile/age@b74dce4cdb (2026-08-31). Data as JSON: /api/errors/c85925ff9437300e. Report an issue: GitHub.