{"record":{"id":"f055c83c44512037","repo":"apache/beam","slug":"could-not-find-file-s","errorCode":null,"errorMessage":"Could not find file %s","messagePattern":"Could not find file (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/storage/GcsPathValidator.java","lineNumber":85,"sourceCode":"    GcsPath gcsPath = getGcsPath(path);\n    checkArgument(gcsPath.isAbsolute(), \"Must provide absolute paths for Dataflow\");\n    checkArgument(\n        !gcsPath.getObject().isEmpty(),\n        \"Missing object or bucket in path: '%s', did you mean: 'gs://some-bucket/%s'?\",\n        gcsPath,\n        gcsPath.getBucket());\n    checkArgument(\n        !gcsPath.getObject().contains(\"//\"),\n        \"Dataflow Service does not allow objects with consecutive slashes\");\n    return gcsPath.toResourceName();\n  }\n\n  private void verifyPathIsAccessible(String path, String errorMessage) {\n    GcsPath gcsPath = getGcsPath(path);\n    try {\n      gcpOptions.getGcsUtil().verifyBucketAccessible(gcsPath);\n    } catch (IOException e) {\n      throw new RuntimeException(String.format(errorMessage, path), e);\n    }\n  }\n\n  private GcsPath getGcsPath(String path) {\n    try {\n      return GcsPath.fromUri(path);\n    } catch (IllegalArgumentException e) {\n      throw new IllegalArgumentException(\n          String.format(\"Expected a valid 'gs://' path but was given '%s'\", path), e);\n    }\n  }\n}\n","sourceCodeStart":67,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/storage/GcsPathValidator.java#L67-L98","documentation":"GcsPathValidator.verifyPathIsAccessible calls GcsUtil.verifyBucketAccessible and wraps IOException in RuntimeException formatted with the caller's errorMessage (e.g. 'Could not find file %s'). It means the GCS bucket backing the given path could not be confirmed accessible during pipeline validation.","triggerScenarios":"validateInputFilePatternSupported / validateOutputFilePrefixSupported on a gs:// path whose bucket does not exist, is not readable by the caller, is misspelled, or the GCS call fails transiently.","commonSituations":"Typo in bucket or file path; input file deleted before launch; service account lacking storage.objects.get/list; running on Dataflow with a bucket in another project; requester-pays bucket without a user project.","solutions":["Verify the path with `gsutil ls gs://bucket/path` using the same credentials","Correct typos and confirm the input files exist before launching","Grant the identity read access (roles/storage.objectViewer) on the bucket","Retry on transient errors; check GCS status if failures persist"],"exampleFix":"// before\n--input=gs://my-bukket/data/*.json // typo\n// after\n--input=gs://my-bucket/data/*.json // verified via gsutil ls","handlingStrategy":"validation","validationCode":"// verify GCS input exists before launching the pipeline\n// gsutil -q stat gs://bucket/path  (exit code 0 means accessible)\nProcess p = new ProcessBuilder(\"gsutil\", \"-q\", \"stat\", gcsPath).redirectErrorStream(true).start();\nif (p.waitFor() != 0) throw new IllegalArgumentException(\"GCS path not accessible: \" + gcsPath);","typeGuard":"boolean isGcsPath(String s) { return s != null && s.startsWith(\"gs://\") && s.length() > 5; }","tryCatchPattern":"try {\n  options.as(GcsOptions.class).getPathValidator().validateInputFilePatternSupported(path);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Could not find file\")) {\n    throw new IllegalArgumentException(\"Check bucket name, object existence, and read permissions for \" + path, e);\n  }\n  throw e;\n}","preventionTips":["Run `gsutil ls` on all inputs with the same credentials before launch","Grant roles/storage.objectViewer on input buckets","Double-check bucket spelling and region/project","For requester-pays buckets, configure the user project in GcsOptions"],"tags":["gcp","gcs","file-not-found","validation","java"],"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-14T16:17:12.679Z"}