{"record":{"id":"06ab82e8c717f35d","repo":"apache/flink","slug":"cannot-parse-jobid-from-hexstring-the-expecte","errorCode":null,"errorMessage":"Cannot parse JobID from \"{hexString}\". The expected format is [0-9a-fA-F]{32}, e.g. fd72014d4c864993a2e5a9287b4a9c5d.","messagePattern":"Cannot parse JobID from \"(.+?)\"\\. The expected format is \\[0-9a-fA-F\\](.+?), e\\.g\\. fd72014d4c864993a2e5a9287b4a9c5d\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/JobID.java","lineNumber":108,"sourceCode":"\n    public static JobID fromByteBuffer(ByteBuffer buf) {\n        long lower = buf.getLong();\n        long upper = buf.getLong();\n        return new JobID(lower, upper);\n    }\n\n    /**\n     * Parses a JobID from the given string.\n     *\n     * @param hexString string representation of a JobID\n     * @return Parsed JobID\n     * @throws IllegalArgumentException if the JobID could not be parsed from the given string\n     */\n    public static JobID fromHexString(String hexString) {\n        try {\n            return new JobID(StringUtils.hexStringToByte(hexString));\n        } catch (Exception e) {\n            throw new IllegalArgumentException(\n                    \"Cannot parse JobID from \\\"\"\n                            + hexString\n                            + \"\\\". The expected format is \"\n                            + \"[0-9a-fA-F]{32}, e.g. fd72014d4c864993a2e5a9287b4a9c5d.\",\n                    e);\n        }\n    }\n}\n","sourceCodeStart":90,"sourceCodeEnd":117,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/JobID.java#L90-L117","documentation":"Thrown by JobID.fromHexString when the input cannot be decoded into the 16-byte (128-bit) JobID. A JobID's hex form must be exactly 32 hex characters. Malformed input (wrong length, non-hex characters, null) makes StringUtils.hexStringToByte throw, which is wrapped into this IllegalArgumentException showing the bad value and the expected format.","triggerScenarios":"Calling JobID.fromHexString(bad) with null, wrong-length, or non-hex input; round-tripping a JobID through a layer that altered the string; confusing JobID with a numeric job sequence id.","commonSituations":"Parsing JobID from a REST URL path, log, or savepoint metadata file that included whitespace or a prefix; copy-paste truncation; JSON keys whose value carried quotes or escaping.","solutions":["Validate with ^[0-9a-fA-F]{32}$ and trim before calling fromHexString.","Only ever persist the output of JobID.toString()/toHexString() and read it back verbatim.","When sourcing from URLs/JSON, decode and trim first, and assert length 32."],"exampleFix":"// before\nJobID id = JobID.fromHexString(raw);\n// after\nString hex = raw == null ? \"\" : raw.trim();\nif (!hex.matches(\"[0-9a-fA-F]{32}\")) {\n    throw new IllegalArgumentException(\"Invalid JobID: \" + raw);\n}\nJobID id = JobID.fromHexString(hex);","handlingStrategy":"validation","validationCode":"String hex = hexString == null ? \"\" : hexString.trim();\nif (!hex.matches(\"[0-9a-fA-F]{32}\")) {\n    throw new IllegalArgumentException(\"Invalid JobID hex: \" + hexString);\n}\nJobID id = JobID.fromHexString(hex);","typeGuard":"public static boolean isValidJobIdHex(String s) {\n    return s != null && s.trim().matches(\"[0-9a-fA-F]{32}\");\n}","tryCatchPattern":"try { JobID id = JobID.fromHexString(raw); }\ncatch (IllegalArgumentException e) { /* reject malformed id */ }","preventionTips":["Only persist JobIDs via toString()/toHexString().","Trim and validate external strings before parsing.","Decode URL/JSON-escaped values before validation."],"tags":["job-id","parsing","hex","validation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}