{"record":{"id":"df37af25877477de","repo":"apache/iceberg","slug":"location-does-not-exist-s-df37af","errorCode":null,"errorMessage":"Location does not exist: %s","messagePattern":"Location does not exist: (.+?)","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSExceptionUtil.java","lineNumber":32,"sourceCode":" * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage org.apache.iceberg.gcp.gcs;\n\nimport com.google.cloud.storage.BlobId;\nimport com.google.cloud.storage.StorageException;\nimport java.io.IOException;\nimport org.apache.iceberg.exceptions.NotFoundException;\n\nfinal class GCSExceptionUtil {\n  private GCSExceptionUtil() {}\n\n  static void throwNotFoundIfNotPresent(IOException ioException, BlobId blobId) {\n    if (ioException.getCause() instanceof StorageException storageException\n        && storageException.getCode() == 404) {\n      throw new NotFoundException(ioException, \"Location does not exist: %s\", blobId.toGsUtilUri());\n    }\n  }\n}\n","sourceCodeStart":14,"sourceCodeEnd":36,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSExceptionUtil.java#L14-L36","documentation":"GCSExceptionUtil.throwNotFoundIfNotPresent converts a GCS StorageException with code 404 into Iceberg's NotFoundException with 'Location does not exist: %s' carrying the gs:// URI of the BlobId. It signals the requested GCS object simply does not exist.","triggerScenarios":"An IO operation (read/exists/delete via GCS FileIO) fails with StorageException code 404 for the blob at the given BlobId.","commonSituations":"Typo in the warehouse/bucket path, object deleted by a lifecycle rule or another job, wrong environment (dev vs prod bucket), or reading a table whose metadata file was removed.","solutions":["Verify the full gs:// URI — bucket name and object path — actually exists (gsutil ls)","Check bucket lifecycle/retention rules that may delete objects unexpectedly","Confirm you are pointing at the intended environment/project and warehouse location","Catch NotFoundException in callers and handle missing-object cases explicitly"],"exampleFix":"// before\nGCSExceptionUtil.throwNotFoundIfNotPresent(ioe, blobId);\n// after (caller side)\ntry {\n  fileIO.newInputFile(location);\n} catch (NotFoundException e) {\n  LOG.error(\"Object missing at {} — check path and lifecycle rules\", location);\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// check existence before operating\nBlob blob = storage.get(blobId);\nif (blob == null) { throw new NotFoundException(\"Object absent: \" + blobId.toGsUtilUri()); }","typeGuard":null,"tryCatchPattern":"try { fileIO.newInputFile(gsUri).newStream(); } catch (NotFoundException e) { LOG.warn(\"GCS object missing: {}\", gsUri); /* handle absence */ }","preventionTips":["Validate gs:// paths and bucket names in config","Watch for lifecycle-rule deletions","Distinguish dev/prod buckets per environment"],"tags":["gcp","gcs","not-found","storage","io"],"backgroundTag":"resource-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}