{"record":{"id":"f8048be7f1341dbc","repo":"apache/beam","slug":"illegal-hex-escape-sequence","errorCode":null,"errorMessage":"illegal hex escape sequence","messagePattern":"illegal hex escape sequence","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/QueryUtils.java","lineNumber":326,"sourceCode":"              break;\n            case '`':\n              buf.append('`');\n              break;\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n              if (i + 3 > fieldName.length()) {\n                throw new IllegalArgumentException(\"illegal octal escape sequence\");\n              }\n              buf.appendCodePoint(unescapeOctal(fieldName.substring(i, i + 3)));\n              i += 3;\n              break;\n            case 'x':\n            case 'X':\n              i++;\n              if (i + 2 > fieldName.length()) {\n                throw new IllegalArgumentException(\"illegal hex escape sequence\");\n              }\n              buf.appendCodePoint(unescapeHex(fieldName.substring(i, i + 2)));\n              i += 2;\n              break;\n            case 'u':\n              i++;\n              if (i + 4 > fieldName.length()) {\n                throw new IllegalArgumentException(\"illegal unicode escape sequence\");\n              }\n              buf.appendCodePoint(unescapeHex(fieldName.substring(i, i + 4)));\n              i += 4;\n              break;\n            case 'U':\n              i++;\n              if (i + 8 > fieldName.length()) {\n                throw new IllegalArgumentException(\"illegal unicode escape sequence\");\n              }\n              buf.appendCodePoint(unescapeHex(fieldName.substring(i, i + 8)));","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/QueryUtils.java#L308-L344","documentation":"unescapeFieldName() handles \\x and \\X hex escape sequences requiring exactly two following hex digits; if fewer than two characters remain after the x it throws this IllegalArgumentException. The hex escape is incomplete and the quoted identifier is rejected.","triggerScenarios":"A quoted identifier containing a truncated hex escape, e.g. `a\\x4` or `\\x` as the last characters of the segment content.","commonSituations":"Generated identifiers whose escape sequences were truncated by slicing/truncation, or typos dropping a hex digit when encoding special characters in field names.","solutions":["Provide both hex digits, e.g. \\x41 for 'A'","Remove the incomplete escape if not needed","Validate quoted identifiers contain complete escape sequences before parsing"],"exampleFix":"// before\nOrderByFieldPath.fromString(\"doc.`f\\\\x4`\"); // one hex digit\n// after\nOrderByFieldPath.fromString(\"doc.`f\\\\x41`\");","handlingStrategy":"validation","validationCode":"public static boolean hasCompleteHexEscapes(String s) {\n  java.util.regex.Matcher m = Pattern.compile(\"\\\\\\\\[xX]([0-9A-Fa-f]{0,2})\").matcher(s);\n  while (m.find()) {\n    if (m.group(1).length() < 2) return false;\n  }\n  return true;\n}","typeGuard":null,"tryCatchPattern":"try {\n  OrderByFieldPath p = OrderByFieldPath.fromString(path);\n} catch (IllegalArgumentException e) {\n  LOG.warn(\"Incomplete hex escape in '{}'\", path);\n}","preventionTips":["Always write exactly two hex digits after \\x or \\X","Prefer \\uXXXX escapes for readability in configuration"],"tags":["java","apache-beam","firestore","field-path","escaping"],"backgroundTag":"invalid-escape-sequence","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}