{"record":{"id":"899937b082609199","repo":"apache/beam","slug":"unable-to-load-runtime-value","errorCode":null,"errorMessage":"Unable to load runtime value.","messagePattern":"Unable to load runtime value\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/options/ValueProvider.java","lineNumber":275,"sourceCode":"      }\n      try {\n        Method method = klass.getMethod(methodName);\n        PipelineOptions methodOptions = options.as(klass);\n        InvocationHandler handler = Proxy.getInvocationHandler(methodOptions);\n        @SuppressWarnings(\"unchecked\")\n        ValueProvider<T> result = (ValueProvider<T>) handler.invoke(methodOptions, method, null);\n        // Two cases: If we have deserialized a new value from JSON, it will\n        // be wrapped in a StaticValueProvider, which we can provide here. If\n        // not, there was no JSON value, and we return the default, whether or\n        // not it is null.\n        if (result instanceof StaticValueProvider) {\n          return result.get();\n        }\n        return defaultValue;\n      } catch (OutOfMemoryError oom) {\n        throw oom;\n      } catch (Throwable e) {\n        throw new RuntimeException(\"Unable to load runtime value.\", e);\n      }\n    }\n\n    @Override\n    public boolean isAccessible() {\n      return optionsMap.get(optionsId) != null;\n    }\n\n    /** Returns the property name that corresponds to this provider. */\n    public String propertyName() {\n      return propertyName;\n    }\n\n    @Override\n    public String toString() {\n      if (isAccessible()) {\n        return String.valueOf(get());\n      }","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/options/ValueProvider.java#L257-L293","documentation":"RuntimeValueProvider.get() resolves the underlying option value reflectively at runtime; any Throwable raised during that resolution (except OutOfMemoryError, which is rethrown) is wrapped in a RuntimeException(\"Unable to load runtime value.\"). This indicates the option getter itself failed, e.g. due to deserialization or option-conversion errors.","triggerScenarios":"Calling get() on a RuntimeValueProvider when the underlying getter invocation throws — e.g. the method raises during value computation, the registered options object fails an as(klass) conversion, or reflection/proxy resolution fails.","commonSituations":"Custom PipelineOptions getters with side effects that throw on the worker, incompatible option types registered at runtime, or classpath differences between driver and worker causing reflective failures.","solutions":["Inspect the wrapped cause (e.getCause()) of the RuntimeException to find the root failure","Fix or remove throwing logic in the PipelineOptions getter method backing the provider","Ensure driver and worker classpaths/Beam versions match so reflective resolution succeeds"],"exampleFix":"// before\nString v = options.someComputedValue(); // getter throws internally at runtime\n// after\n// make the getter pure; catch/repair at definition:\n@Implementation... value() { try { return compute(); } catch (Exception e) { return fallback; } }","handlingStrategy":"try-catch","validationCode":"if (!provider.isAccessible()) throw new IllegalStateException(\"provider not accessible; cannot load runtime value yet\");","typeGuard":null,"tryCatchPattern":"try { v = provider.get(); } catch (RuntimeException e) { log.error(\"runtime value load failed\", e.getCause()); v = defaultValue; }","preventionTips":["Always log e.getCause() to diagnose the real failure behind the wrapper","Keep PipelineOptions getter methods side-effect-free and pure","Keep driver and worker classpaths/versions identical to avoid reflective failures","Provide defaultValue() for providers that can fail to resolve"],"tags":["java","apache-beam","value-provider","reflection"],"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"}