docker/cli ยท error
could not parse public key from file: %s: %w
Error message
could not parse public key from file: %s: %w
What it means
Error "could not parse public key from file: %s: %w" thrown in docker/cli.
Source
Thrown at cmd/docker-trust/trust/signer_add.go:134
pubKeys := []data.PublicKey{}
for _, pubKeyPath := range pubKeyPaths {
// Read public key bytes from PEM file, limit to 1 KiB
pubKeyFile, err := os.OpenFile(pubKeyPath, os.O_RDONLY, 0o666)
if err != nil {
return nil, fmt.Errorf("unable to read public key from file: %w", err)
}
defer pubKeyFile.Close()
// limit to
l := io.LimitReader(pubKeyFile, 1<<20)
pubKeyBytes, err := io.ReadAll(l)
if err != nil {
return nil, fmt.Errorf("unable to read public key from file: %w", err)
}
// Parse PEM bytes into type PublicKey
pubKey, err := tufutils.ParsePEMPublicKey(pubKeyBytes)
if err != nil {
return nil, fmt.Errorf("could not parse public key from file: %s: %w", pubKeyPath, err)
}
pubKeys = append(pubKeys, pubKey)
}
return pubKeys, nil
}
View on GitHub (pinned to e9452d6e78)
When it happens
Trigger: Thrown at cmd/docker-trust/trust/signer_add.go:134 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/707efe8039c64e3f.json.
Report an issue: GitHub.