{"record":{"id":"3f1856997e27b8a1","repo":"apache/hadoop","slug":"s-already-exists","errorCode":null,"errorMessage":"%s already exists","messagePattern":"(.+?) already exists","errorType":"exception","errorClass":"PathExistsException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/CopyFromLocalOperation.java","lineNumber":345,"sourceCode":"   * @throws FileAlreadyExistsException - If source is file and destination is path\n   */\n  private void checkDestination(\n      Path dest,\n      File src,\n      boolean overwrite) throws PathExistsException,\n      FileAlreadyExistsException {\n    if (!getDestStatus().isPresent()) {\n      return;\n    }\n\n    if (src.isDirectory() && getDestStatus().get().isFile()) {\n      throw new FileAlreadyExistsException(\n          \"Source '\" + src.getPath() + \"' is directory and \" +\n              \"destination '\" + dest + \"' is file\");\n    }\n\n    if (!overwrite) {\n      throw new PathExistsException(dest + \" already exists\");\n    }\n  }\n\n  /**\n   * Get the final path of a source file with regards to its destination.\n   *\n   * @param src - source path\n   * @return - the final path for the source file to be uploaded to\n   * @throws PathIOException - if a relative path can't be created\n   */\n  private Path getFinalPath(Path src) throws PathIOException {\n    URI currentSrcUri = src.toUri();\n    URI relativeSrcUri = source.toUri().relativize(currentSrcUri);\n    if (relativeSrcUri.equals(currentSrcUri)) {\n      throw new PathIOException(\"Cannot get relative path for URI:\"\n          + relativeSrcUri);\n    }\n","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/CopyFromLocalOperation.java#L327-L363","documentation":"Error \"%s already exists\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/CopyFromLocalOperation.java:345 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the existing destination first or enable overwrite for the copy operation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}