phacility/phabricator · error · Exception
Failed to close file "%s".
Error message
Failed to close file "%s".
What it means
Closing the output failed: fclose/gzclose did not return true. With buffered writes, the close is where an out-of-space condition or I/O error often surfaces, after individual writes appeared to succeed. The workflow throws, and its exception handler removes the incomplete output file, so no truncated dump survives.
Source
Thrown at src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php:189
}
if ($bytes !== strlen($data)) {
throw new Exception(
pht(
'Failed to write %d byte(s) to "%s".',
new PhutilNumber(strlen($data)),
$output_name));
}
}
if ($is_compress) {
$ok = gzclose($file);
} else {
$ok = fclose($file);
}
if ($ok !== true) {
throw new Exception(
pht(
'Failed to close file "%s".',
$output_file));
}
} catch (Exception $ex) {
try {
if ($output_file !== null) {
Filesystem::remove($output_file);
}
} catch (Exception $ex) {
// Ignore any exception.
}
throw $ex;
}
// Give the user a chance to catch things if the results are crazy.
$console->writeErr(View on GitHub (pinned to 5720a38cfe)
Solutions
- Free space on the target filesystem and re-run the whole command — the partial file was removed automatically.
- Write --output to reliable local disk, then copy the finished file to network storage.
- If it recurs on the same device, suspect the medium or filesystem (check dmesg, consider fsck).
Defensive patterns
Strategy: try-catch
Try / catch
try {
// run the renamespace workflow
} catch (Exception $ex) {
// close failed; partial output was removed — free space before retrying
fwrite(STDERR, $ex->getMessage()."\n");
exit(1);
} Prevention
- Avoid NFS/tmpfs destinations for dump-sized outputs.
- Keep headroom of at least the expected dump size on the output volume.
- After every run, verify the output file exists and has the expected size.
When it happens
Trigger: Disk or quota exhausted exactly at flush time; NFS or FUSE filesystems failing the final flush; a medium or filesystem error on close.
Common situations: Output on NFS with quotas; small tmpfs targets; per-user quotas enforced at flush; marginal or failing disks.
Related errors
- Failed to write %d byte(s) to "%s".
- Failed to open output file "%s" for writing.
- Specify the dumpfile to read with "--input", or use "--live"
- Specify namespace to rename from with %s.
- Specify namespace to rename to with %s.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/b5235e4416b2aba3.
Report an issue: GitHub.