{"record":{"id":"eff7220c7945f23f","repo":"iOfficeAI/OfficeCLI","slug":"invalid-path","errorCode":"invalid_path","errorMessage":"dump path cannot be empty. Use '/' for the full document or a sheet path like /Sheet1. Supported: /, /SheetName, /sheet[N]","messagePattern":"dump path cannot be empty\\. Use '/' for the full document or a sheet path like /Sheet1\\. Supported: /, /SheetName, /sheet\\[N\\]","errorType":"exception","errorClass":"CliException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelBatchEmitter.cs","lineNumber":182,"sourceCode":"        EmitDocPropsScan(xl, warnings);\n\n        return (items, warnings);\n    }\n\n    /// <summary>\n    /// Emit a subtree. Supported paths: `/` (full document), `/SheetName`,\n    /// `/sheet[N]`. A single-sheet dump emits `add sheet` (not the\n    /// rename-first-sheet form) so it can replay onto a workbook that\n    /// already has content; workbook-level settings and named ranges are\n    /// NOT included (they live at sibling paths — mirrors the docx/pptx\n    /// subtree contract).\n    /// </summary>\n    public static (List<BatchItem> Items, List<UnsupportedWarning> Warnings) EmitExcel(\n        ExcelHandler xl, string path)\n    {\n        const string SupportedHint = \"Supported: /, /SheetName, /sheet[N]\";\n        if (string.IsNullOrEmpty(path))\n            throw new CliException($\"dump path cannot be empty. Use '/' for the full document or a sheet path like /Sheet1. {SupportedHint}\")\n                { Code = \"invalid_path\" };\n        if (path == \"/\") return EmitExcel(xl);\n\n        var token = path.Trim('/');\n        if (token.Length == 0 || token.Contains('/'))\n            throw new CliException($\"dump path not supported: {path}. {SupportedHint}\")\n                { Code = \"unsupported_path\" };\n\n        var sheetName = xl.ResolveDumpSheetName(token)\n            ?? throw new CliException($\"dump path not found: {path} (no such sheet)\")\n                { Code = \"path_not_found\" };\n\n        var items = new List<BatchItem>();\n        var warnings = new List<UnsupportedWarning>();\n        EmitSheet(xl, sheetName, renameFirstSheet: false, items, warnings, claimExistingSheet: true);\n        EmitPivotTables(xl, \"/\" + sheetName, xl.GetDumpPivotCount(sheetName), items, warnings);\n        EmitSlicers(xl, \"/\" + sheetName, xl.GetDumpSlicerCount(sheetName), items, warnings);\n        return (items, warnings);","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelBatchEmitter.cs#L164-L200","documentation":"Thrown by ExcelBatchEmitter.EmitExcel when the dump path argument is null or empty. The emitter supports three path forms: '/' (full document), '/SheetName' (single sheet), and '/sheet[N]' (sheet by 1-based index). An empty path is rejected explicitly rather than falling through, because it would be ambiguous — the caller likely forgot to specify which subtree to dump. The SupportedHint constant lists all valid forms in the message.","triggerScenarios":"Calling EmitExcel(xl, \"\") or EmitExcel(xl, null) — the dump path argument was not provided or was passed as an empty string. This typically happens when a caller computes the path dynamically and the computation yields empty, or when the '/' default was expected but not explicitly passed.","commonSituations":"A dump command invoked without a path argument; a script that builds the path conditionally and hits a branch where the variable is empty; a programmatic caller that assumed '/' was the default when it is not.","solutions":["Pass '/' explicitly to dump the full document.","Pass '/SheetName' (e.g. '/Sheet1') to dump a specific sheet by name.","Pass '/sheet[N]' (e.g. '/sheet[0]') to dump a sheet by 0-based index.","If the path is computed dynamically, add a fallback: string.IsNullOrEmpty(path) ? \"/\" : path."],"exampleFix":"// before: empty path\nvar (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, \"\");\n\n// after: full document dump\nvar (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, \"/\");","handlingStrategy":"validation","validationCode":"// Validate dump path before calling EmitExcel\nstatic string NormalizeDumpPath(string? path) => string.IsNullOrEmpty(path) ? \"/\" : path;\nvar (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, NormalizeDumpPath(dumpPath));","typeGuard":"static bool IsValidDumpPath(string? path) =>\n    !string.IsNullOrEmpty(path) && (path == \"/\" || !string.IsNullOrEmpty(path.Trim('/')));","tryCatchPattern":"try\n{\n    var (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, path);\n}\ncatch (CliException ex) when (ex.Code == \"invalid_path\")\n{\n    // Empty path — default to full document dump\n    var (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, \"/\");\n}","preventionTips":["Always pass an explicit path: '/' for the full document, '/SheetName' for a single sheet.","If the path is computed dynamically, provide '/' as the default fallback.","Validate the path is non-empty before calling the emitter."],"tags":["excel","batch-emitter","dump-path","invalid-path","argument-validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}