{"record":{"id":"8268e4efa759a3bb","repo":"apache/iceberg","slug":"invalid-status-name-s","errorCode":null,"errorMessage":"Invalid status name: %s","messagePattern":"Invalid status name: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/PlanStatus.java","lineNumber":45,"sourceCode":"  CANCELLED(\"cancelled\"),\n  FAILED(\"failed\");\n\n  private final String status;\n\n  PlanStatus(String status) {\n    this.status = status;\n  }\n\n  public String status() {\n    return status;\n  }\n\n  public static PlanStatus fromName(String status) {\n    Preconditions.checkArgument(status != null, \"Status is null\");\n    try {\n      return PlanStatus.valueOf(status.toUpperCase(Locale.ROOT));\n    } catch (IllegalArgumentException e) {\n      throw new IllegalArgumentException(String.format(\"Invalid status name: %s\", status), e);\n    }\n  }\n}\n","sourceCodeStart":27,"sourceCodeEnd":49,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/PlanStatus.java#L27-L49","documentation":"PlanStatus.fromName converts a wire/status string into the PlanStatus enum. It uppercases the input and calls valueOf; if the string does not name a valid enum constant, it rethrows IllegalArgumentException with 'Invalid status name'. Null input is rejected separately as 'Status is null'.","triggerScenarios":"Parsing a server response containing an unknown status string; passing a lowercase/hyphenated status like 'in-progress' when the enum constant is different; deserializing responses from a newer server whose enum has statuses this client version does not know.","commonSituations":"REST server and client at different Iceberg versions (new server sends a status the old client lacks); hand-written test fixtures with misspelled status names; case/whitespace issues in config or JSON.","solutions":["Use the exact enum constant names: see PlanStatus (e.g. SUBMITTED, COMPLETED, FAILED)","Upgrade the client/server so both sides share the same PlanStatus enum values","Trim and check spelling of the status string before parsing","Handle unknown statuses gracefully instead of forwarding raw server strings to fromName"],"exampleFix":"// before\nPlanStatus s = PlanStatus.fromName(response.status()); // raw server value\n// after\nString name = response.status() == null ? null : response.status().trim();\nPlanStatus s = PlanStatus.fromName(name);","handlingStrategy":"validation","validationCode":"boolean isValidStatus(String s) {\n  return s != null && java.util.Arrays.stream(PlanStatus.values())\n      .anyMatch(v -> v.name().equalsIgnoreCase(s.trim()));\n}","typeGuard":"PlanStatus safeFromName(String s) {\n  try { return PlanStatus.fromName(s); } catch (IllegalArgumentException e) { return null; }\n}","tryCatchPattern":"try {\n  status = PlanStatus.fromName(raw);\n} catch (IllegalArgumentException e) {\n  log.warn(\"Unknown plan status {}, treating as UNKNOWN\", raw, e);\n  status = null;\n}","preventionTips":["Only pass exact PlanStatus enum constant names","Trim server-provided status strings before parsing","Keep client and server Iceberg versions aligned","Treat unknown statuses defensively instead of hard-failing"],"tags":["enum","parsing","rest"],"backgroundTag":"invalid-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}