{"record":{"id":"0d673d37fef63bd3","repo":"benbjohnson/litestream","slug":"failed-to-delete-object-s-w","errorCode":null,"errorMessage":"failed to delete object %s: %w","messagePattern":"failed to delete object (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nats/replica_client.go","lineNumber":448,"sourceCode":"\t\tSize:      int64(objectInfo.Size),\n\t\tCreatedAt: timestamp,\n\t}, nil\n}\n\n// DeleteLTXFiles deletes one or more LTX files.\nfunc (c *ReplicaClient) DeleteLTXFiles(ctx context.Context, a []*ltx.FileInfo) error {\n\tif err := c.Init(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, fileInfo := range a {\n\t\tobjectPath := c.ltxPath(fileInfo.Level, fileInfo.MinTXID, fileInfo.MaxTXID)\n\n\t\tc.logger.Debug(\"deleting ltx file\", \"level\", fileInfo.Level, \"minTXID\", fileInfo.MinTXID, \"maxTXID\", fileInfo.MaxTXID, \"path\", objectPath)\n\n\t\tif err := c.objectStore.Delete(ctx, objectPath); err != nil {\n\t\t\tif !isNotFoundError(err) {\n\t\t\t\treturn fmt.Errorf(\"failed to delete object %s: %w\", objectPath, err)\n\t\t\t}\n\t\t}\n\t\tinternal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, \"DELETE\").Inc()\n\t}\n\n\treturn nil\n}\n\n// DeleteAll deletes all files in the object store.\nfunc (c *ReplicaClient) DeleteAll(ctx context.Context) error {\n\tif err := c.Init(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// List all objects in the bucket\n\tobjectList, err := c.objectStore.List(ctx)\n\tif err != nil {\n\t\t// NATS returns \"no objects found\" when bucket is empty, treat as empty list","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/nats/replica_client.go#L430-L466","documentation":"Wraps objectStore.Delete failure in the NATS replica client's DeleteLTXFiles. Fires when removing an LTX object from the NATS object store fails for reasons other than the object not existing (which is tolerated); replication cleanup cannot complete.","triggerScenarios":"Thrown at nats/replica_client.go:448 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify delete permissions on the NATS object store","Check NATS connectivity; deletion is retried on the next retention pass"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}