{"record":{"id":"1e7c5fe967b19965","repo":"apache/hadoop","slug":"copy-s-s-failed","errorCode":null,"errorMessage":"copy(%s->%s) failed.","messagePattern":"copy\\((.+?)->(.+?)\\) failed\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-gcp/src/main/java/org/apache/hadoop/fs/gs/GoogleCloudStorage.java","lineNumber":798,"sourceCode":"          configuration.getMaxRewriteChunkSize() / (1024 * 1024));\n    }\n\n    String srcString = StringPaths.fromComponents(srcBucketName, srcObjectName);\n    String dstString = StringPaths.fromComponents(dstBucketName, dstObjectName);\n\n    try {\n      CopyWriter copyWriter = storage.copy(copyRequestBuilder.build());\n      while (!copyWriter.isDone()) {\n        copyWriter.copyChunk();\n        LOG.trace(\n            \"Copy ({} to {}) did not complete. Resuming...\", srcString, dstString);\n      }\n      LOG.trace(\"Successfully copied {} to {}\", srcString, dstString);\n    } catch (StorageException e) {\n      if (ErrorTypeExtractor.getErrorType(e) == ErrorTypeExtractor.ErrorType.NOT_FOUND) {\n        throw createFileNotFoundException(srcBucketName, srcObjectName, new IOException(e));\n      } else {\n        throw new IOException(String.format(\"copy(%s->%s) failed.\", srcString, dstString), e);\n      }\n    }\n  }\n\n  static void validateCopyArguments(\n      Map<StorageResourceId, StorageResourceId> sourceToDestinationObjectsMap,\n      GoogleCloudStorage gcsImpl)\n      throws IOException {\n    checkNotNull(sourceToDestinationObjectsMap, \"srcObjects must not be null\");\n\n    if (sourceToDestinationObjectsMap.isEmpty()) {\n      return;\n    }\n\n    Map<StorageResourceId, GoogleCloudStorageItemInfo> bucketInfoCache = new HashMap<>();\n\n    for (Map.Entry<StorageResourceId, StorageResourceId> entry :\n        sourceToDestinationObjectsMap.entrySet()) {","sourceCodeStart":780,"sourceCodeEnd":816,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-gcp/src/main/java/org/apache/hadoop/fs/gs/GoogleCloudStorage.java#L780-L816","documentation":"The inner copy helper runs storage.copy() and pumps copyChunk() until done; a StorageException classified NOT_FOUND is translated into FileNotFoundException for the source, but every other StorageException is wrapped as IOException(\"copy(%s->%s) failed.\") with the cause. The message means the GCS copy/rewrite request itself failed for a non-404 reason.","triggerScenarios":"copy()/copyWithRewrite between two objects when the request is rejected: source exists but permission denied on source or destination, destination precondition failure, rate limiting, or GCS transient errors mid-chunk of a large rewrite.","commonSituations":"Service account missing write on the destination bucket; cross-config copy hitting IAM boundaries; heavy distcp triggering throttling; transient 5xx during long-running rewrites of large objects.","solutions":["Read the nested StorageException reason: 403 → grant storage.objects.get on source and create on destination; 429/5xx → retry","Verify source and destination paths (bucket names, object names) are correct and non-empty","Retry the copy job for transient causes; distcp supports keeping partial state","For repeated 429s, lower copy concurrency or request quota relief"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  gcs.copy(map);\n} catch (FileNotFoundException e) {\n  // source object missing — already mapped by the connector\n  throw e;\n} catch (IOException e) {\n  if (e.getMessage().contains(\"copy(\") && e.getCause() instanceof StorageException) {\n    int code = ((StorageException) e.getCause()).getCode();\n    if (code == 403) { /* grant get on src, create on dst */ }\n    else if (code == 429 || code / 100 == 5) { /* back off and retry */ }\n  }\n  throw e;\n}","preventionTips":["Pre-grant source-read and destination-write IAM roles for copy jobs","Lower copy concurrency when hitting 429s","Make copy loops idempotent so caller-level retries are safe"],"tags":["gcs","hadoop-gcp","copy","permissions","storageexception"],"backgroundTag":"copy-object-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}