{"record":{"id":"fd3e5262a52b9350","repo":"apache/beam","slug":"format","errorCode":null,"errorMessage":"${format}","messagePattern":"\\$\\{format\\}","errorType":"http","errorClass":"IOException","httpStatus":404,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/FakeDatasetService.java","lineNumber":1006,"sourceCode":"        Maps.newHashMap();\n    synchronized (FakeDatasetService.class) {\n      for (Map.Entry<String, List<String>> entry : this.insertErrors.entrySet()) {\n        TableRow tableRow = BigQueryHelpers.fromJsonString(entry.getKey(), TableRow.class);\n        List<TableDataInsertAllResponse.InsertErrors> allErrors = Lists.newArrayList();\n        for (String errorsString : entry.getValue()) {\n          allErrors.add(\n              BigQueryHelpers.fromJsonString(\n                  errorsString, TableDataInsertAllResponse.InsertErrors.class));\n        }\n        parsedInsertErrors.put(tableRow, allErrors);\n      }\n    }\n    return parsedInsertErrors;\n  }\n\n  @FormatMethod\n  void throwNotFound(@FormatString String format, Object... args) throws IOException {\n    throw new IOException(\n        String.format(format, args),\n        new HttpResponseException.Builder(404, String.format(format, args), new HttpHeaders())\n            .build());\n  }\n}\n","sourceCodeStart":988,"sourceCodeEnd":1012,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/FakeDatasetService.java#L988-L1012","documentation":"FakeDatasetService.throwNotFound is a @FormatMethod helper that throws an IOException wrapping an HTTP 404 HttpResponseException with a formatted message. The fake calls it for any simulated BigQuery resource lookup failure (missing table, dataset, job, etc.), so callers see a 404-shaped IOException whose message is the format string filled with the offending resource id.","triggerScenarios":"Any fake-backed BigQuery operation referencing a resource that was not registered in the fake: reading/writing a table or dataset never inserted via the fake's create/put methods, loading a job id that does not exist, or querying a nonexistent table.","commonSituations":"Tests where fixture setup (creating dataset/table in the fake) was skipped or ran after the code under test; wrong project/dataset/table identifiers in test configuration; typos in table specs passed to BigQueryIO.read/write.","solutions":["Create the dataset/table in the fake before the operation: call the fake's createDataset/createTable (or insert rows to auto-create) with the exact identifiers used by the pipeline.","Verify the table spec string (project:dataset.table) matches what the test registered.","Catch IOException and inspect the embedded HttpResponseException status code (404) to distinguish not-found from other fake failures.","Re-run with the fake's state dump (e.g., list tables) to confirm the resource exists."],"exampleFix":"// before\npipeline.apply(BigQueryIO.read().from(\"proj:data.missing_table\"));\n// after\nfakeDatasetService.createDataset(\"proj\", \"data\", \"US\");\nfakeDatasetService.createTable(\"proj\", \"data\", \"missing_table\", schema);\npipeline.apply(BigQueryIO.read().from(\"proj:data.missing_table\"));","handlingStrategy":"try-catch","validationCode":"if (fake.getTable(tableSpec) == null) {\n  throw new IllegalStateException(\"Table not registered in fake: \" + tableSpec);\n}","typeGuard":null,"tryCatchPattern":"try {\n  runPipelineAgainst(fake);\n} catch (IOException e) {\n  Throwable cause = e.getCause();\n  if (cause instanceof HttpResponseException && ((HttpResponseException) cause).getStatusCode() == 404) {\n    throw new AssertionError(\"Fake BigQuery resource missing (did you create dataset/table?): \" + e.getMessage(), e);\n  }\n  throw e;\n}","preventionTips":["Register datasets and tables in the fake during test setup, before pipeline execution.","Use table spec constants shared between fake setup and pipeline configuration.","Assert fake resource existence in @Before/setup hooks."],"tags":["java","bigquery","test-harness","http-404","resource-not-found"],"backgroundTag":"http-error-response","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"}