{"record":{"id":"5cf8af6dc0d57176","repo":"coollabsio/coolify","slug":"the-s3-storage-or-backup-filename-is-unavailable-f","errorCode":null,"errorMessage":"The S3 storage or backup filename is unavailable for upload cleanup.","messagePattern":"The S3 storage or backup filename is unavailable for upload cleanup\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Jobs/VolumeBackupRecoveryJob.php","lineNumber":103,"sourceCode":"            .'if [ \"$running\" != true ] && ! docker start \"$container\" >/dev/null; then echo \"$container\" >> '\n            .escapeshellarg($remainingFile).'; status=1; fi; done < '.escapeshellarg($stateFile).'; fi; '\n            .'if [ -s '.escapeshellarg($remainingFile).' ]; then mv '.escapeshellarg($remainingFile).' '.escapeshellarg($stateFile)\n            .'; else rm -f '.escapeshellarg($stateFile).' '.escapeshellarg($remainingFile).'; fi; exit $status';\n\n        instant_remote_process(['sh -c '.escapeshellarg($script)], $server, disableMultiplexing: true);\n        $execution->update([\n            'stop_container_ids' => null,\n            'stop_recovery_pending' => false,\n        ]);\n    }\n\n    public static function cleanupS3Upload(ScheduledVolumeBackupExecution $execution): void\n    {\n        $execution->loadMissing('s3');\n        $s3 = $execution->s3;\n\n        if (! $s3 || blank($execution->filename)) {\n            throw new \\RuntimeException('The S3 storage or backup filename is unavailable for upload cleanup.');\n        }\n\n        deleteBackupsS3($execution->filename, $s3);\n        $execution->update([\n            's3_cleanup_pending' => false,\n            's3_storage_deleted' => true,\n        ]);\n    }\n\n    public static function stateFile(ScheduledVolumeBackupExecution $execution): string\n    {\n        return '/tmp/coolify-volume-backup-'.$execution->uuid.'.stopped';\n    }\n}\n","sourceCodeStart":85,"sourceCodeEnd":118,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Jobs/VolumeBackupRecoveryJob.php#L85-L118","documentation":"cleanupS3Upload() deletes the object uploaded to S3 during a volume backup (when only the S3 copy should remain). It loads the execution's s3 relation and requires a non-blank filename; if either is missing it throws, which leaves the uploaded object orphaned in the bucket.","triggerScenarios":"The S3 storage row was deleted between the upload and the cleanup step, or the execution row has a blank filename (e.g. written by an older Coolify version before filename tracking existed).","commonSituations":"Deleting an S3 storage while a backup execution is mid-run; upgrading Coolify with in-flight executions; executions created before the filename column was populated.","solutions":["Delete the orphaned object manually from the bucket - locate it by the execution uuid / backup filename prefix","Keep (or re-create) the S3 storage row until executions referencing it finish cleanup, since the relation must resolve to delete the object","After upgrading, let pending executions settle before removing storages"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// guard before queuing S3 cleanup\n$execution->loadMissing('s3');\nif (! $execution->s3 || blank($execution->filename)) {\n    // do not enqueue automated cleanup; queue a manual-deletion alert instead\n    send_internal_notification('S3 object needs manual cleanup for execution '.$execution->uuid);\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not delete S3 storages while executions with s3_cleanup_pending exist","Persist the execution filename in the same transaction that confirms the upload","Periodically audit the bucket for objects under the backup prefix that no execution references"],"tags":["backup","s3","cleanup","orphaned-files"],"backgroundTag":"dangling-foreign-key-reference","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}