getsops/sops · error
failed to parse and add to age identities: %w
Error message
failed to parse and add to age identities: %w
What it means
Error "failed to parse and add to age identities: %w" thrown in getsops/sops.
Source
Thrown at age/keysource.go:150
// It allows for creating a (local) keyservice.KeyServiceServer which parses
// identities only once, to then inject them using ApplyToMasterKey() for all
// requests.
type ParsedIdentities []age.Identity
// Import attempts to parse the given identities, to then add them to itself.
// It returns any parsing error.
// A single identity argument is allowed to be a multiline string containing
// multiple identities. Empty lines and lines starting with "#" are ignored.
// It is not thread safe, and parallel importing would better be done by
// parsing (using age.ParseIdentities) and appending to the slice yourself, in
// combination with e.g. a sync.Mutex.
func (i *ParsedIdentities) Import(identity ...string) error {
// one identity per line
r := strings.NewReader(strings.Join(identity, "\n"))
identities, err := parseIdentities(r, false)
if err != nil {
return fmt.Errorf("failed to parse and add to age identities: %w", err)
}
*i = append(*i, identities...)
return nil
}
// ApplyToMasterKey configures the ParsedIdentities on the provided key.
func (i ParsedIdentities) ApplyToMasterKey(key *MasterKey) {
key.parsedIdentities = i
}
// Encrypt takes a SOPS data key, encrypts it with the Recipient, and stores
// the result in the EncryptedKey field.
func (key *MasterKey) Encrypt(dataKey []byte) error {
if key.parsedRecipient == nil {
parsedRecipient, err := parseRecipient(key.Recipient)
if err != nil {
log.WithField("recipient", key.parsedRecipient).Info("Encryption failed")
return errView on GitHub (pinned to 13442bb981)
When it happens
Trigger: Thrown at age/keysource.go:150 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of getsops/sops@13442bb981 (2026-09-01).
Data as JSON: /api/errors/5c929552788c3b2e.
Report an issue: GitHub.