{"record":{"id":"b89abde58344835d","repo":"apache/beam","slug":"no-option-found-with-name-s","errorCode":null,"errorMessage":"No option found with name %s.","messagePattern":"No option found with name (.+?)\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java","lineNumber":1391,"sourceCode":"      return new Builder(new HashMap<>(this.options));\n    }\n\n    public static Options.Builder builder() {\n      return new Builder();\n    }\n\n    public static Options none() {\n      return new Options();\n    }\n\n    /** Get the value of an option. If the option is not found null is returned. */\n    @SuppressWarnings(\"TypeParameterUnusedInFormals\")\n    public <T> T getValue(String optionName) {\n      Option option = options.get(optionName);\n      if (option != null) {\n        return option.getValue();\n      }\n      throw new IllegalArgumentException(\n          String.format(\"No option found with name %s.\", optionName));\n    }\n\n    /** Get the value of an option. If the option is not found null is returned. */\n    public <T> T getValue(String optionName, Class<T> valueClass) {\n      return getValue(optionName);\n    }\n\n    /** Get the value of an option. If the option is not found the default value is returned. */\n    public <T> T getValueOrDefault(String optionName, T defaultValue) {\n      Option option = options.get(optionName);\n      if (option != null) {\n        return option.getValue();\n      }\n      return defaultValue;\n    }\n\n    /** Get the type of an option. */","sourceCodeStart":1373,"sourceCodeEnd":1409,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java#L1373-L1409","documentation":"Schema.Options.getValue(optionName) throws IllegalArgumentException when no option with that name exists in the options map. It is a strict lookup: unlike getValue(name, class), there is no null-returning variant.","triggerScenarios":"Calling schema.getOptions().getValue(\"name\") where setOption was never called with that exact option name (typo, case mismatch, or option set on a different Schema instance).","commonSituations":"Renaming options between pipeline versions; hardcoding option strings that drift from what producers set; reading options from a schema constructed by another library path.","solutions":["Check hasOption(optionName) before calling getValue.","Use the two-argument getValue(name, valueClass) only after confirming existence, or guard with hasOption to get null-safe behavior.","Fix the option name string to match exactly what setOption stored."],"exampleFix":"// before\nString v = schema.getOptions().getValue(\"owner\");\n\n// after\nString v = schema.getOptions().hasOption(\"owner\")\n    ? schema.getOptions().getValue(\"owner\", String.class)\n    : null;","handlingStrategy":"validation","validationCode":"// Java: check option existence first\nboolean present = schema.getOptions().hasOption(\"owner\");","typeGuard":"// Java\npublic static <T> T optionOrNull(Schema s, String name, Class<T> clazz) {\n  return s.getOptions().hasOption(name) ? s.getOptions().getValue(name, clazz) : null;\n}","tryCatchPattern":null,"preventionTips":["Always call hasOption before getValue/getType.","Keep option names in shared constants to avoid typos."],"tags":["java","schema","options","missing-key"],"backgroundTag":"missing-required-option","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"}