{"record":{"id":"6d17c5b1dfd5382f","repo":"apache/beam","slug":"schema-is-not-instanceof-catalogmanagerschema-or","errorCode":null,"errorMessage":"Schema is not instanceof CatalogManagerSchema or BeamCalciteSchema","messagePattern":"Schema is not instanceof CatalogManagerSchema or BeamCalciteSchema","errorType":"validation","errorClass":"SqlUtil.newContextException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/parser/SqlSetOptionBeam.java","lineNumber":69,"sourceCode":"      CatalogManagerSchema catalogManagerSchema = (CatalogManagerSchema) schema;\n      if (value != null) {\n        catalogManagerSchema.setPipelineOption(pair.right, SqlDdlNodes.getString(value));\n      } else if (\"ALL\".equals(pair.right)) {\n        catalogManagerSchema.removeAllPipelineOptions();\n      } else {\n        catalogManagerSchema.removePipelineOption(pair.right);\n      }\n    } else if (schema instanceof BeamCalciteSchema) {\n      BeamCalciteSchema beamCalciteSchema = (BeamCalciteSchema) schema;\n      if (value != null) {\n        beamCalciteSchema.setPipelineOption(pair.right, SqlDdlNodes.getString(value));\n      } else if (\"ALL\".equals(pair.right)) {\n        beamCalciteSchema.removeAllPipelineOptions();\n      } else {\n        beamCalciteSchema.removePipelineOption(pair.right);\n      }\n    } else {\n      throw SqlUtil.newContextException(\n          name.getParserPosition(),\n          RESOURCE.internal(\"Schema is not instanceof CatalogManagerSchema or BeamCalciteSchema\"));\n    }\n  }\n}\n\n// End SqlDropObject.java\n","sourceCodeStart":51,"sourceCodeEnd":77,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/parser/SqlSetOptionBeam.java#L51-L77","documentation":"SET (pipeline option) operations require the schema to be a CatalogManagerSchema or BeamCalciteSchema so Beam can get/set/remove pipeline options. If execute() resolves any other schema type, it raises this internal error because pipeline options cannot be stored there.","triggerScenarios":"`SET <option> = 'value'` (or SET '<option>' / RESET variants) in a session whose resolved schema is neither CatalogManagerSchema nor BeamCalciteSchema.","commonSituations":"Running Beam SET commands over a plain Calcite schema connection; embedding Beam SQL with custom root schemas; typos causing resolution to a non-Beam schema.","solutions":["Run SET against a Beam SQL connection backed by BeamCalciteSchema/CatalogManagerSchema","Use the default Beam SQL environment (e.g. BeamSqlEnv or the standard SQL shell)","Verify the schema the statement resolves to in your embedded setup","Set pipeline options programmatically via PipelineOptions if SET is unavailable"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (!(schema instanceof BeamCalciteSchema) && !(schema instanceof CatalogManagerSchema)) {\n  throw new IllegalStateException(\"SET pipeline options requires a Beam-managed schema\");\n}","typeGuard":"boolean supportsPipelineOptions(Schema s) {\n  return s instanceof BeamCalciteSchema || s instanceof CatalogManagerSchema;\n}","tryCatchPattern":null,"preventionTips":["Run SET/RESET pipeline-option statements only in standard Beam SQL sessions","Set options via PipelineOptions API in embedded/custom setups","Verify resolved schema type before issuing SET commands"],"tags":["sql","pipeline-options","internal-error"],"backgroundTag":"internal-invariant-violation","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"}