{"record":{"id":"e72553be144293cd","repo":"apache/beam","slug":"the-copy-source-does-not-exist","errorCode":null,"errorMessage":"The copy source does not exist.","messagePattern":"The copy source does not exist\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/azure/src/main/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystem.java","lineNumber":338,"sourceCode":"      final AzfsResourceId destinationPath = destinationPathsIterator.next();\n      copy(sourcePath, destinationPath);\n    }\n  }\n\n  @VisibleForTesting\n  void copy(AzfsResourceId sourcePath, AzfsResourceId destinationPath) throws IOException {\n    checkArgument(\n        sourcePath.getBlob() != null && destinationPath.getBlob() != null,\n        \"This method is intended to copy file-like resources, not directories.\");\n\n    // get source blob client\n    BlobClient srcBlobClient =\n        client\n            .get()\n            .getBlobContainerClient(sourcePath.getContainer())\n            .getBlobClient(sourcePath.getBlob());\n    if (!srcBlobClient.exists()) {\n      throw new FileNotFoundException(\"The copy source does not exist.\");\n    }\n\n    // get destination blob client\n    BlobContainerClient destBlobContainerClient =\n        client.get().getBlobContainerClient(destinationPath.getContainer());\n    if (!destBlobContainerClient.exists()) {\n      client.get().createBlobContainer(destinationPath.getContainer());\n      LOG.info(\"Created a container called {}\", destinationPath.getContainer());\n    }\n    BlobClient destBlobClient = destBlobContainerClient.getBlobClient(destinationPath.getBlob());\n\n    destBlobClient.copyFromUrl(srcBlobClient.getBlobUrl() + generateSasToken());\n  }\n\n  @VisibleForTesting\n  /** Generate an SAS Token if the user did not provide one through pipeline options */\n  @SuppressWarnings(\"JavaUtilDate\")\n  String generateSasToken() throws IOException {","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/azure/src/main/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystem.java#L320-L356","documentation":"In copy(), the source blob client is resolved and its existence verified before any copy is attempted. If the source blob does not exist, a FileNotFoundException with this message is thrown. Azure's server-side copy would otherwise fail asynchronously, so the library fails fast and explicitly.","triggerScenarios":"Calling FileSystems.copy(src, dest) where a source azfs path points to a nonexistent blob (or the source container does not exist).","commonSituations":"Rename/move operations (rename() calls copy() then delete()) where the source was already moved or deleted; incorrect source path casing; race with another process that removed the source.","solutions":["Verify the source blob exists (az storage blob exists or FileSystems.match) before copying.","Fix the source path spelling/casing.","If using rename(), confirm the source was not already moved in a previous attempt (idempotency).","Create the missing source (or recreate it) if it should exist."],"exampleFix":"// before\nFileSystems.copy(\n    ImmutableList.of(FileSystems.matchNewResource(\"azfs://c/missing-src.txt\", false)),\n    ImmutableList.of(FileSystems.matchNewResource(\"azfs://c/dst.txt\", false)));\n// after\nMatchResult src = FileSystems.match(\"azfs://c/src.txt\");\nif (src.status() == MatchResult.Status.OK) {\n  FileSystems.copy(\n      ImmutableList.of(src.metadata().get(0).resourceId()),\n      ImmutableList.of(FileSystems.matchNewResource(\"azfs://c/dst.txt\", false)));\n}","handlingStrategy":"validation","validationCode":"MatchResult src = FileSystems.match(srcPath);\nif (src.status() != MatchResult.Status.OK || src.metadata().isEmpty()) {\n  throw new FileNotFoundException(\"Copy source missing: \" + srcPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n  FileSystems.copy(srcIds, dstIds);\n} catch (FileNotFoundException e) {\n  LOG.warn(\"copy source vanished: {}\", e.getMessage());\n  // retry with re-matched source or skip\n}","preventionTips":["Re-match source paths immediately before copy in case they changed.","Make move/rename workflows idempotent: check whether the destination already exists first.","Avoid concurrent processes deleting the same source blobs."],"tags":["azure","blob-storage","file-not-found","copy","io"],"backgroundTag":"file-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}