{"record":{"id":"3a717c42ec64b93c","repo":"apache/hadoop","slug":"could-not-complete-transfer-reply-code-replyco","errorCode":null,"errorMessage":"Could not complete transfer, Reply Code - {replyCode}","messagePattern":"Could not complete transfer, Reply Code - (.+?)","errorType":"exception","errorClass":"FTPException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ftp/FTPFileSystem.java","lineNumber":369,"sourceCode":"      // which in turn will logout and disconnect from FTP server\n      if (outputStream != null) {\n        IOUtils.closeStream(outputStream);\n      }\n      disconnect(client);\n      throw new IOException(\"Unable to create file: \" + file + \", Aborting\");\n    }\n\n    FSDataOutputStream fos = new FSDataOutputStream(outputStream, statistics) {\n      @Override\n      public void close() throws IOException {\n        super.close();\n        if (!client.isConnected()) {\n          throw new FTPException(\"Client not connected\");\n        }\n        boolean cmdCompleted = client.completePendingCommand();\n        disconnect(client);\n        if (!cmdCompleted) {\n          throw new FTPException(\"Could not complete transfer, Reply Code - \"\n              + client.getReplyCode());\n        }\n      }\n    };\n    return fos;\n  }\n\n  /** This optional operation is not yet supported. */\n  @Override\n  public FSDataOutputStream append(Path f, int bufferSize,\n      Progressable progress) throws IOException {\n    throw new UnsupportedOperationException(\"Append is not supported \"\n        + \"by FTPFileSystem\");\n  }\n  \n  /**\n   * Convenience method, so that we don't open a new connection when using this\n   * method from within another method. Otherwise every API invocation incurs","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ftp/FTPFileSystem.java#L351-L387","documentation":"On stream close, completePendingCommand() must collect the final FTP reply that ends the data transfer. A false return means the server aborted or never completed the STOR — the exception carries the reply code (e.g. 426 transfer aborted, 451 local error, 552 quota exceeded) and the file on the server is likely partial or absent.","triggerScenarios":"Server runs out of disk/quota mid-upload; data connection broken mid-transfer; server-side antivirus or policy aborts the file; control connection returns 4xx/5xx at completion time.","commonSituations":"Disk-full FTP servers failing only for large uploads; quotas hit mid-file; flaky networks where the data channel dies but the control channel survives long enough to report.","solutions":["Read the reply code from the exception message and match it against the FTP server log","Check server disk space and the user's quota, then retry the write","Verify the uploaded file (size/hash) on the server; delete partial files before retrying","Reduce concurrent uploads if the server is refusing under load"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try (FSDataOutputStream out = fs.create(path, true)) {\n  out.write(data);\n} catch (FTPException e) {\n  // reply code is in the message; transfer did not complete\n  LOG.warn(\"FTP transfer incomplete: {}\", e.getMessage());\n  fs.delete(path, false); // drop the partial file\n  retryWrite(fs, path, data); // server-side quota/disk issues must be fixed first\n}","preventionTips":["Monitor FTP server disk space and quotas before they hit zero mid-upload","Delete partial uploads before retrying so retries are idempotent","Match the reply code in the message against the server log to find the abort cause"],"tags":["ftp","transfer-aborted","stor","quota"],"backgroundTag":"ftp-transfer-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}