{"record":{"id":"883c880f32fb9c56","repo":"apache/beam","slug":"failed-to-parse-option-for-s","errorCode":null,"errorMessage":"Failed to parse option for %s","messagePattern":"Failed to parse option for (.+?)","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoSchemaTranslator.java","lineNumber":418,"sourceCode":"          case STRING:\n          case BOOLEAN:\n          case LOGICAL_TYPE:\n          case ROW:\n          case ARRAY:\n          case ITERABLE:\n            @SuppressWarnings(\"unchecked\")\n            ProtoBeamConverter.ProtoToBeamConverter<Object, Object> protoToBeamConverter =\n                ProtoBeamConverter.createProtoToBeamConverter(fieldType);\n            Object value = protoToBeamConverter.convert(entry.getValue());\n            optionsBuilder.setOption(prefix + fieldDescriptor.getFullName(), fieldType, value);\n            break;\n          case MAP:\n          case DATETIME:\n          default:\n            throw new IllegalStateException(\"These datatypes are not possible in extentions.\");\n        }\n      } catch (RuntimeException e) {\n        throw new RuntimeException(\n            Strings.lenientFormat(\"Failed to parse option for %s\", fieldDescriptor.getName()), e);\n      }\n    }\n    return optionsBuilder;\n  }\n}\n","sourceCodeStart":400,"sourceCodeEnd":425,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoSchemaTranslator.java#L400-L425","documentation":"getOptions parses Beam-specific schema options stored in proto field options and translates their values into Beam option values. Any RuntimeException raised while parsing a field's option value is rethrown wrapped as \"Failed to parse option for <field name>\" with the original exception as the cause. It indicates a schema option value in the proto descriptor could not be converted to the expected Beam type.","triggerScenarios":"Reading schema options (getSchemaOptions/getFieldOptions) from a proto descriptor whose option value type doesn't match what the parser expects (e.g. an option declared for one Beam type — STRING, BOOL, etc. — carrying a value of an incompatible kind), triggering the IllegalStateException or a value-parsing failure.","commonSituations":"Hand-edited or code-generated protos with Beam schema annotations whose option values mismatch the declared Beam option type; protos annotated by another tool/version with a different option encoding.","solutions":["Inspect the wrapped cause exception to find which field option value failed and fix the option's value type in the .proto (e.g. supply the string/bool/int the declared Beam option type expects).","Remove the offending schema option annotation from the field if it isn't needed.","Regenerate/normalize the proto annotations with the same Beam version used at runtime to avoid encoding mismatches."],"exampleFix":"// before\nFieldOptions opts = ...; // beam:option string_type option carrying an int value -> wrapped parse failure\n// after\n// in .proto: (beam_schema_option).beam_string_type = \"expected-string-value\";\n// ensure value kind matches declared option type","handlingStrategy":"validation","validationCode":"// Java: before translating, verify each field's Beam schema option value matches its declared option type\nfor (Descriptors.FieldDescriptor f : msg.getDescriptorForType().getFields()) {\n  // optionType vs optionValue kind must agree (STRING->string, BOOL->boolean, ...)\n}","typeGuard":null,"tryCatchPattern":"try { Schema s = ProtoSchemaTranslator.getSchema(descriptor); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Failed to parse option for \")) { /* inspect e.getCause() for the failing field option and fix its value type */ } else throw e; }","preventionTips":["Generate Beam schema options only with tooling matching your Beam version; avoid hand-editing option values.","Validate option value kinds (string/bool/int per declared type) in a proto lint step.","Inspect e.getCause() first when debugging — the wrapper message names the field."],"tags":["protobuf","schema-options","java","parse-error"],"backgroundTag":"invalid-config-value","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"}