{"record":{"id":"deb6f908b2c0ec72","repo":"iOfficeAI/OfficeCLI","slug":"path-not-found","errorCode":"path_not_found","errorMessage":"dump path not found: {path} (no such sheet)","messagePattern":"dump path not found: (.+?) \\(no such sheet\\)","errorType":"exception","errorClass":"CliException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelBatchEmitter.cs","lineNumber":192,"sourceCode":"    /// 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;\n        try { wb = xl.GetDumpWorkbookNode(); }\n        catch { return; }\n\n        var props = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelBatchEmitter.cs#L174-L210","documentation":"Thrown by ExcelBatchEmitter.EmitExcel when the dump path token (after trimming slashes) does not match any sheet in the workbook. The emitter calls xl.ResolveDumpSheetName(token) which tries to resolve the token as a sheet name (case-insensitive) or as a '/sheet[N]' index. If no match is found, the path is reported as not found. This is the Excel equivalent of a 404 for dump paths.","triggerScenarios":"Passing '/NonexistentSheet' when the workbook has no sheet by that name; passing '/sheet[5]' when the workbook has only 3 sheets; a typo in the sheet name; the sheet was deleted between the time the path was constructed and the dump was called.","commonSituations":"A dump command targeting a sheet name that was mistyped or that does not exist in the current version of the workbook; a batch replay where the sheet was supposed to be created by an earlier command that failed silently; a case mismatch on a case-sensitive platform.","solutions":["List available sheets first: use the query or get command on '/' to enumerate sheets.","Check the sheet name spelling and casing.","If using '/sheet[N]' index form, verify N is within the valid range (0-based, up to sheet count - 1).","Ensure any preceding 'add sheet' commands in a batch completed successfully before dumping."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the sheet exists before dumping\nvar sheetNames = xl.GetSheetNames(); // or equivalent enumeration\nif (!sheetNames.Any(s => s.Equals(sheetToken, StringComparison.OrdinalIgnoreCase)))\n    throw new InvalidOperationException($\"No sheet matching '{sheetToken}'\");\nvar (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, \"/\" + sheetToken);","typeGuard":null,"tryCatchPattern":"try\n{\n    var (items, warnings) = ExcelBatchEmitter.EmitExcel(xl, path);\n}\ncatch (CliException ex) when (ex.Code == \"path_not_found\")\n{\n    // Sheet not found — enumerate available sheets and report\n    logger.LogError(\"Sheet not found for path '{Path}'. Available sheets: {Sheets}\",\n        path, string.Join(\", \", xl.GetSheetNames()));\n    throw;\n}","preventionTips":["Enumerate sheets first (query on '/') to discover valid names before dumping.","Check sheet name spelling and casing.","Ensure any preceding 'add sheet' commands succeed before dumping in a batch.","For index-based paths, verify the index is within the sheet count."],"tags":["excel","batch-emitter","dump-path","path-not-found","sheet-resolution"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}