Error invoking barman-cloud-backup-delete: 'BackupInfo' object has no attribute 'encryption' and no __dict__ for setting new attributes
Hi,
Pruning of old backups is broken right now. I have attached the details of my deployment:
❯ k cnpg version
Build: {Version:1.25.0 Commit:bad5a251 Date:2024-12-23}
Image ID: ghcr.io/cloudnative-pg/plugin-barman-cloud-sidecar-testing@sha256:77a3497a7c98bd1950329a9fdb62005f823ed2e84de1fc7430fde892d313f7d0
Image: ghcr.io/cloudnative-pg/cloudnative-pg:1.26.1
Image ID: ghcr.io/cloudnative-pg/cloudnative-pg@sha256:dfb65c0b6b14e6fb10d36a4e46c0368c062adf5f436c7b0ff0251d408cc34c07
I have deployed the plugin using kustomization: https://github.com/cloudnative-pg/plugin-barman-cloud/kubernetes?ref=v0.5.0
Log
{"level":"error","ts":"2025-07-30T06:55:15.259932953Z","msg":"Retention policy enforcement failed","logging_pod":"database-1","error":"exit status 1","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).Start\n\t/workspace/internal/cnpgi/instance/retention.go:50\nsigs.k8s.io/controller-runtime/pkg/manager.(*runnableGroup).reconcile.func1\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/manager/runnable_group.go:226"}
{"level":"info","ts":"2025-07-30T07:00:15.286258466Z","msg":"Applying backup retention policy","logging_pod":"database-1","retentionPolicy":"10d"}
{"level":"error","ts":"2025-07-30T07:00:18.680113524Z","logger":"barman","msg":"Error invoking barman-cloud-backup-delete","logging_pod":"database-1","options":["--endpoint-url","https://host","--cloud-provider","aws-s3","--retention-policy","RECOVERY WINDOW OF 10 DAYS","s3://bucket/path/","database"],"stdout":"","stderr":"2025-07-30 07:00:18,079 [257141] WARNING: Unable to open backup.info file for 20250717T060002: 'BackupInfo' object has no attribute 'encryption' and no __dict__ for setting new attributes\n2025-07-30 07:00:18,256 [257141] WARNING: Unable to open backup.info file for 20250721T060003: 'BackupInfo' object has no attribute 'encryption' and no __dict__ for setting new attributes\n2025-07-30 07:00:18,343 [257141] WARNING: Unable to open backup.info file for 20250724T060002: 'BackupInfo' object has no attribute 'encryption' and no __dict__ for setting new attributes\n2025-07-30 07:00:18,453 [257141] WARNING: Unable to open backup.info file for 20250728T060002: 'BackupInfo' object has no attribute 'encryption' and no __dict__ for setting new attributes\n2025-07-30 07:00:18,454 [257141] ERROR: Cannot read the following backups: ['20250717T060002', '20250721T060003', '20250724T060002', '20250728T060002']\nUnsafe to proceed with deletion due to failure reading backup catalog\n","error":"exit status 1","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/barman-cloud/pkg/command.DeleteBackupsByPolicy\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/command/backupdelete.go:71\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).maintenance\n\t/workspace/internal/cnpgi/instance/retention.go:131\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).cycle\n\t/workspace/internal/cnpgi/instance/retention.go:80\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).Start\n\t/workspace/internal/cnpgi/instance/retention.go:48\nsigs.k8s.io/controller-runtime/pkg/manager.(*runnableGroup).reconcile.func1\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/manager/runnable_group.go:226"}
{"level":"error","ts":"2025-07-30T07:00:18.680195245Z","msg":"while enforcing retention policies","logging_pod":"database-1","error":"exit status 1","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).maintenance\n\t/workspace/internal/cnpgi/instance/retention.go:138\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).cycle\n\t/workspace/internal/cnpgi/instance/retention.go:80\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).Start\n\t/workspace/internal/cnpgi/instance/retention.go:48\nsigs.k8s.io/controller-runtime/pkg/manager.(*runnableGroup).reconcile.func1\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/manager/runnable_group.go:226"}
{"level":"error","ts":"2025-07-30T07:00:18.680248606Z","msg":"Retention policy enforcement failed","logging_pod":"database-1","error":"exit status 1","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.(*CatalogMaintenanceRunnable).Start\n\t/workspace/internal/cnpgi/instance/retention.go:50\nsigs.k8s.io/controller-runtime/pkg/manager.(*runnableGroup).reconcile.func1\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/manager/runnable_group.go:226"}
Please advise. Thank you!
Hi @jorijn! I'm Dosu and I’m helping the plugin-barman-cloud team.
This error happens because the barman-cloud-backup-delete command expects every backup.info file to have an 'encryption' attribute, but some of your backup.info files are missing it—likely because they were created by an older version of barman-cloud or with a different schema. When the retention policy tries to prune these backups, it fails to read the catalog and aborts the deletion process, which blocks pruning entirely.
There are currently no documented workarounds or migration steps for this scenario, and the code does not handle missing attributes gracefully. The only immediate workaround is to manually delete the problematic backups from your storage bucket (be careful: this is destructive and should only be done if you are certain those backups are no longer needed). After manual cleanup, retention enforcement should resume working for newer backups that have the expected format.
If you need to retain those backups, you could try manually editing the backup.info files to add a dummy 'encryption' attribute, but this is risky and not officially supported. There is no evidence of a fix or migration tool for this in recent plugin-barman-cloud or barman-cloud releases, so you may want to keep an eye on future updates for improved backward compatibility or error handling.
The root cause and flow are described in the retention policy code and error handling logic here.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
I just found out that the kustomization.yaml of 0.5.0 overwrites the image and sets it to the testing version:
https://github.com/cloudnative-pg/plugin-barman-cloud/blob/v0.5.0/kubernetes/kustomization.yaml
I took the Kubernetes directory from this project, and (wrongfully) assumed that this was also a supported way of deploying the plugin. Perhaps this is intended, perhaps not, but clarifying the documentation might seem like a good idea :)