{"record":{"id":"25ae641300242450","repo":"apache/beam","slug":"unparsable-resource-hint","errorCode":null,"errorMessage":"Unparsable resource hint: ","messagePattern":"Unparsable resource hint: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/resourcehints/ResourceHints.java","lineNumber":111,"sourceCode":"  private ResourceHints(ImmutableMap<String, ResourceHint> hints) {\n    this.hints = hints;\n  }\n\n  /** Creates a {@link ResourceHints} instance with no hints. */\n  public static ResourceHints create() {\n    return EMPTY;\n  }\n\n  /** Creates a {@link ResourceHints} instance with hints supplied in options. */\n  public static ResourceHints fromOptions(PipelineOptions options) {\n    ResourceHintsOptions resourceHintsOptions = options.as(ResourceHintsOptions.class);\n    ResourceHints result = create();\n    List<String> hints = resourceHintsOptions.getResourceHints();\n    Splitter splitter = Splitter.on('=').limit(2);\n    for (String hint : hints) {\n      List<String> parts = splitter.splitToList(hint);\n      if (parts.size() != 2) {\n        throw new IllegalArgumentException(\"Unparsable resource hint: \" + hint);\n      }\n      String nameOrUrn = parts.get(0);\n      String stringValue = parts.get(1);\n      String urn;\n      if (hintNameToUrn.containsKey(nameOrUrn)) {\n        urn = hintNameToUrn.get(nameOrUrn);\n      } else if (!nameOrUrn.startsWith(\"beam:resources:\")) {\n        // Allow unknown hints to be passed, but validate a little bit to prevent typos.\n        throw new IllegalArgumentException(\"Unknown resource hint: \" + hint);\n      } else {\n        urn = nameOrUrn;\n      }\n      ResourceHint value =\n          Preconditions.checkNotNull(parsers.getOrDefault(urn, StringHint::new)).apply(stringValue);\n      result = result.withHint(urn, value);\n    }\n    return result;\n  }","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/resourcehints/ResourceHints.java#L93-L129","documentation":"ResourceHints.fromOptions parses each hint string from the 'resourceHints' pipeline option expecting the form 'name=value' (or 'urn=value'). If a hint string contains no '=' separator (after splitting with limit 2, it doesn't produce exactly 2 parts), Beam throws IllegalArgumentException('Unparsable resource hint: <hint>').","triggerScenarios":"Passing a pipeline option like --resourceHints=cpu_amount or --resourceHints=accelerator:gpu (missing '=') such that Splitter.on('=').limit(2).splitToList(hint) returns a list whose size != 2.","commonSituations":"CLI misconfiguration where users write 'name:value' instead of 'name=value'; empty strings in the hints list; YAML/JSON quoting stripping the '='; copy-paste of hint names without values.","solutions":["Format each hint as 'name=value' or 'beam:resources:xxx=value', e.g. --resourceHints=cpu_count=2","Check the option value for stray characters or quoting that removed the '='","Split multiple hints correctly (the option accepts a list; don't join hints without separators Beam understands)","Log/print the offending hint from the message and fix that exact entry"],"exampleFix":"// before\n--resourceHints=accelerator:gpu\n\n// after\n--resourceHints=accelerator=gpu","handlingStrategy":"validation","validationCode":"// Validate each hint before handing to Beam\nfor (String hint : hints) {\n  if (!hint.contains(\"=\") || hint.startsWith(\"=\") || hint.endsWith(\"=\")) {\n    throw new IllegalArgumentException(\"Hint must be name=value: \" + hint);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  ResourceHints.fromOptions(options);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unparsable resource hint:\")) {\n    logger.error(\"Fix hint format to name=value: {}\", e.getMessage());\n  }\n}","preventionTips":["Always write hints as name=value, never name:value","Validate CLI flags with a script before launching pipelines","Quote option values in YAML/shell so '=' survives parsing"],"tags":["java","apache-beam","resource-hints","cli-options","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}