{"record":{"id":"4f8d9643e7836706","repo":"apache/iceberg","slug":"invalid-edge-interpolation-algorithm-s","errorCode":null,"errorMessage":"Invalid edge interpolation algorithm: %s","messagePattern":"Invalid edge interpolation algorithm: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/types/EdgeAlgorithm.java","lineNumber":52,"sourceCode":"  THOMAS,\n  /**\n   * Thomas, Paul D. Mathematical models for navigation systems. US Naval Oceanographic Office,\n   * 1965.\n   */\n  ANDOYER,\n  /**\n   * <a href=\"https://link.springer.com/content/pdf/10.1007/s00190-012-0578-z.pdf\">Karney, Charles\n   * FF. \"Algorithms for geodesics.\" Journal of Geodesy 87 (2013): 43-55 </a>, and <a\n   * href=\"https://geographiclib.sourceforge.io/\">GeographicLib</a>.\n   */\n  KARNEY;\n\n  public static EdgeAlgorithm fromName(String algorithmName) {\n    Preconditions.checkNotNull(algorithmName, \"Invalid edge interpolation algorithm: null\");\n    try {\n      return EdgeAlgorithm.valueOf(algorithmName.toUpperCase(Locale.ROOT));\n    } catch (IllegalArgumentException e) {\n      throw new IllegalArgumentException(\n          String.format(\"Invalid edge interpolation algorithm: %s\", algorithmName), e);\n    }\n  }\n\n  @Override\n  public String toString() {\n    return name().toLowerCase(Locale.ROOT);\n  }\n}\n","sourceCodeStart":34,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/types/EdgeAlgorithm.java#L34-L62","documentation":"EdgeAlgorithm.fromName converts a string from table metadata (geospatial edge interpolation name) into the EdgeAlgorithm enum. If the name is not a valid enum constant (after upper-casing) it throws IllegalArgumentException including the offending name, chained from the valueOf failure. Null names are rejected separately with the same message.","triggerScenarios":"Reading geometry/geography column metadata whose edge-interpolation string is misspelled, in unexpected case (with non-ASCII), or written by a newer spec with a new algorithm this enum lacks.","commonSituations":"Hand-edited or third-party-written table metadata; newer Iceberg spec adding an edge algorithm before this client supports it.","solutions":["Correct the algorithm name in the metadata to one of the enum constants (e.g. SPHERICAL, VINCENTY, THOMAS, ANDOYER, KARNEY)","Upgrade the client if the metadata uses a newer spec algorithm","Catch IllegalArgumentException and fall back to a default algorithm if approximation is acceptable"],"exampleFix":"// before\nEdgeAlgorithm a = EdgeAlgorithm.fromName(\"sphericalextra\"); // throws\n// after\nEdgeAlgorithm a = EdgeAlgorithm.fromName(\"spherical\");","handlingStrategy":"try-catch","validationCode":"boolean known = Arrays.stream(EdgeAlgorithm.values()).anyMatch(a -> a.name().equalsIgnoreCase(name));","typeGuard":"Optional<EdgeAlgorithm> safeFromName(String n) { return n == null ? Optional.empty() : Arrays.stream(EdgeAlgorithm.values()).filter(a -> a.name().equalsIgnoreCase(n)).findFirst(); }","tryCatchPattern":"try { alg = EdgeAlgorithm.fromName(n); } catch (IllegalArgumentException e) { alg = EdgeAlgorithm.KARNEY; log.warn(\"Unknown edge algorithm, using default\"); }","preventionTips":["Only write enum-constant names into geo metadata","Keep clients upgraded for new spec algorithms","Normalize case before lookup"],"tags":["java","enum","geospatial","invalid-enum-value"],"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"}