netbirdio/netbird · error
write public keys file
Error message
write public keys file (%s): %w
What it means
Writing the bundled public-keys file failed in handleBundlePubKeys after keys were read and combined. The path is in the message; typical causes are a read-only output directory or missing permissions. The bundle operation itself succeeded — only persistence failed.
Solutions
- mkdir -p the output directory and confirm write permission
- Remove or chown a stale bundle file from a previous run
- Use an absolute output path to avoid working-directory surprises
Defensive patterns
Strategy: validation
Validate before calling
os.MkdirAll(filepath.Dir(bundlePubKeysFile), 0o700)
if err := os.WriteFile(bundlePubKeysFile+".probe", []byte{}, 0o600); err != nil { ... }
os.Remove(bundlePubKeysFile + ".probe") Prevention
- Create and permission the output directory in a preparatory CI step
- Recreate the whole output directory each run instead of reusing it
- Use consistent uid across pipeline steps that write release artifacts
When it happens
Trigger: bundle-pub-keys writing to a path whose directory does not exist or is not writable; existing bundle file owned by another user.
Common situations: Output dir never created in the release pipeline; rerunning as a different user over an earlier root-owned bundle; read-only artifact mount.
Related errors
- failed to write output files
- failed to write revocation list file
- failed to write signature file
- write private key file
- write public key file
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/8edf30092ded6c07.
Report an issue: GitHub.
Appendix: source
Thrown at client/cmd/signer/artifactkey.go:166
pubPem, err := os.ReadFile(pubFile)
if err != nil {
return fmt.Errorf("read public key file: %w", err)
}
pk, err := reposign.ParseArtifactPubKey(pubPem)
if err != nil {
return fmt.Errorf("failed to parse artifact key: %w", err)
}
publicKeys = append(publicKeys, pk)
}
parsedKeys, signature, err := reposign.BundleArtifactKeys(privateRootKey, publicKeys)
if err != nil {
return fmt.Errorf("bundle artifact keys: %w", err)
}
if err := os.WriteFile(bundlePubKeysFile, parsedKeys, 0o600); err != nil {
return fmt.Errorf("write public keys file (%s): %w", bundlePubKeysFile, err)
}
signatureFile := bundlePubKeysFile + ".sig"
if err := os.WriteFile(signatureFile, signature, 0o600); err != nil {
return fmt.Errorf("write signature file (%s): %w", signatureFile, err)
}
cmd.Printf("✅ Bundle created with %d public keys.\n", len(artifactPubKeyFiles))
return nil
}
View on GitHub (pinned to 93e97f4bf1)