{"record":{"id":"788e3708d76b8519","repo":"iOfficeAI/OfficeCLI","slug":"unsupported-path","errorCode":"unsupported_path","errorMessage":"dump path not supported: {path}. Supported: /, /SheetName, /sheet[N]","messagePattern":"dump path not supported: (.+?)\\. Supported: /, /SheetName, /sheet\\[N\\]","errorType":"exception","errorClass":"CliException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelBatchEmitter.cs","lineNumber":188,"sourceCode":"    /// 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);\n    }\n\n    private static void EmitWorkbookSettings(ExcelHandler xl, List<BatchItem> items,\n        List<UnsupportedWarning> warnings)\n    {\n        DocumentNode wb;","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelBatchEmitter.cs#L170-L206","documentation":"Thrown by ExcelBatchEmitter.EmitExcel when the dump path, after trimming slashes, is either empty (e.g. path was just \"/\") or contains additional '/' separators indicating a deeper path than supported. The emitter only supports single-level sheet paths — paths like '/Sheet1/Range' or '/a/b/c' are not valid dump targets. Note: path == '/' is handled separately before this check (it triggers a full-document dump), so this error fires only on paths that have content but are structurally unsupported.","triggerScenarios":"Passing a multi-segment path like '/Sheet1/A1:B2' (the emitter does not support cell-range dumps), passing '//' (trims to empty token), or passing '/Sheet1/' (the trailing slash is trimmed, leaving just 'Sheet1' which would actually be valid — so this specifically catches multi-segment or empty-after-trim paths).","commonSituations":"A user assuming cell-range or row-level dump paths are supported (they are not — only sheet-level); a path with extra slashes from string concatenation bugs; a path that was intended for a different command (e.g. a query path) mistakenly passed to the dump emitter.","solutions":["Use only sheet-level paths: '/SheetName' or '/sheet[N]'.","Use '/' for the full document.","For cell-level data, use the query/get commands instead of dump.","Remove extra path segments — the emitter does not descend below the sheet level."],"exampleFix":"// before: unsupported multi-segment path\nExcelBatchEmitter.EmitExcel(xl, \"/Sheet1/A1:B2\");\n\n// after: dump the sheet, then query cells separately\nvar (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, \"/Sheet1\");","handlingStrategy":"validation","validationCode":"// Validate dump path structure before calling EmitExcel\nstatic bool IsSupportedDumpPath(string path)\n{\n    if (string.IsNullOrEmpty(path) || path == \"/\") return true;\n    var token = path.Trim('/');\n    return token.Length > 0 && !token.Contains('/');\n}","typeGuard":"static bool IsSupportedDumpPath(string path)\n{\n    if (string.IsNullOrEmpty(path) || path == \"/\") return true;\n    var token = path.Trim('/');\n    return !string.IsNullOrEmpty(token) && !token.Contains('/');\n}","tryCatchPattern":"try\n{\n    var (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, path);\n}\ncatch (CliException ex) when (ex.Code == \"unsupported_path\")\n{\n    // Multi-segment or malformed path — use sheet-level only\n    logger.LogError(\"Unsupported dump path '{Path}'. Use /, /SheetName, or /sheet[N].\", path);\n    throw;\n}","preventionTips":["Use only single-segment paths after the leading slash: '/SheetName' or '/sheet[N]'.","Do not pass cell-range or row-level paths to the dump emitter — use query/get for those.","Validate the path has no interior slashes before calling EmitExcel."],"tags":["excel","batch-emitter","dump-path","unsupported-path","argument-validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}