{"record":{"id":"f0410958f469b998","repo":"iOfficeAI/OfficeCLI","slug":"expected-base64-id-base64-target-0-1-entries-sep","errorCode":null,"errorMessage":"Expected base64(id),base64(target),0|1 entries separated by '|'.","messagePattern":"Expected base64\\(id\\),base64\\(target\\),0\\|1 entries separated by '\\|'\\.","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs","lineNumber":513,"sourceCode":"    {\n        static string B64(string value) => Convert.ToBase64String(\n            System.Text.Encoding.UTF8.GetBytes(value));\n        return string.Join(\"|\", hyperlinks.Select(h =>\n            $\"{B64(h.Id)},{B64(h.Target)},{(h.IsExternal ? \"1\" : \"0\")}\"));\n    }\n\n    internal static List<DumpDrawingHyperlinkSpec> DecodeDumpDrawingHyperlinks(\n        string encoded)\n    {\n        static string FromB64(string value) => System.Text.Encoding.UTF8.GetString(\n            Convert.FromBase64String(value));\n        var result = new List<DumpDrawingHyperlinkSpec>();\n        if (string.IsNullOrEmpty(encoded)) return result;\n        foreach (var entry in encoded.Split('|', StringSplitOptions.RemoveEmptyEntries))\n        {\n            var fields = entry.Split(',');\n            if (fields.Length != 3 || (fields[2] != \"0\" && fields[2] != \"1\"))\n                throw new FormatException(\n                    \"Expected base64(id),base64(target),0|1 entries separated by '|'.\");\n            result.Add(new DumpDrawingHyperlinkSpec\n            {\n                Id = FromB64(fields[0]),\n                Target = FromB64(fields[1]),\n                IsExternal = fields[2] == \"1\",\n            });\n        }\n        return result;\n    }\n\n    /// <summary>\n    /// Build the dump replay sequence for worksheet shapes without destroying\n    /// real DrawingML groups. A grouped TwoCellAnchor is carried verbatim when\n    /// every relationship referenced inside it is a hyperlink relationship;\n    /// those lightweight relationships can be recreated safely on replay.\n    ///\n    /// Groups that reference package parts (pictures/charts/etc.) fall back to","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs#L495-L531","documentation":"Thrown by DecodeDumpDrawingHyperlinks when an entry in the pipe-delimited dump-replay string does not match the exact 'base64(id),base64(target),0|1' shape. This is a round-trip format produced by the sibling EncodeDumpDrawingHyperlinks for replaying dumped drawing hyperlinks without a JSON serializer in the single-file executable. FormatException (not ArgumentException) signals corrupt/malformed transport data rather than bad user input.","triggerScenarios":"Decoding a string where an entry has !=3 comma-fields, or where the third field is not literally '0' or '1'. Examples: 'aGQ=bmV3.doc,2' (wrong flag), 'id,target,1' (forgot base64), 'aGQ=' (only one field), or a hand-edited pipe string that lost a field. Also triggers if a base64 payload itself was split or trimmed of its '=' padding so the comma split yields the wrong count.","commonSituations":"Hand-editing a dumped drawing-hyperlink replay string; passing the output through a shell/pipe that interpreted ',' or '|' specially; mixing versions where the encode format changed; truncating the string in a log/copy-paste so the last entry is partial.","solutions":["Regenerate the encoded string from EncodeDumpDrawingHyperlinks rather than authoring by hand.","If you must author, ensure every entry is exactly b64(id),b64(target),0 or b64(id),b64(target),1, joined by '|'.","Verify each id/target is standard base64 (A-Za-z0-9+/= only) so it cannot contain ',' or '|' and corrupt the split.","Check for shell quoting issues: wrap the whole value in single quotes so '|' and ',' are not interpreted."],"exampleFix":"// before\nDecodeDumpDrawingHyperlinks(\"id,target,1\")\n// after\nDecodeDumpDrawingHyperlinks(Convert.ToBase64String(UTF8.GetBytes(\"id\")) + \",\" + Convert.ToBase64String(UTF8.GetBytes(\"target\")) + \",1\")","handlingStrategy":"validation","validationCode":"bool IsValidDumpHyperlinkEncoding(string encoded)\n{\n    if (string.IsNullOrEmpty(encoded)) return true;\n    foreach (var entry in encoded.Split('|', StringSplitOptions.RemoveEmptyEntries))\n    {\n        var f = entry.Split(',');\n        if (f.Length != 3 || (f[2] != \"0\" && f[2] != \"1\")) return false;\n        try { Convert.FromBase64String(f[0]); Convert.FromBase64String(f[1]); }\n        catch { return false; }\n    }\n    return true;\n}","typeGuard":"static bool IsDumpHyperlinkEncoding(string s)\n    => string.IsNullOrEmpty(s) || s.Split('|', StringSplitOptions.RemoveEmptyEntries)\n        .All(e => { var f = e.Split(','); return f.Length == 3 && (f[2]==\"0\"||f[2]==\"1\"); });","tryCatchPattern":"try { var links = DecodeDumpDrawingHyperlinks(encoded); }\ncatch (FormatException ex) when (ex.Message.Contains(\"base64(id),base64(target)\"))\n{\n    // the dump-replay stream is corrupt; regenerate via EncodeDumpDrawingHyperlinks\n}","preventionTips":["Prefer regenerating the encoded string with EncodeDumpDrawingHyperlinks over hand-authoring.","Keep base64 payloads intact (do not strip '=' padding).","Shell-quote the whole value with single quotes so '|' and ',' survive.","Validate field count and flag char before decoding if the string crossed an untrusted boundary."],"tags":["excel","drawing","hyperlink","base64","dump-replay","validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}