{"record":{"id":"7760b317b3ad5d36","repo":"iOfficeAI/OfficeCLI","slug":"path-cannot-be-empty","errorCode":null,"errorMessage":"Path cannot be empty.","messagePattern":"Path cannot be empty\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Query.cs","lineNumber":19,"sourceCode":"// Copyright 2026 OfficeCLI (https://OfficeCLI.AI)\n// SPDX-License-Identifier: Apache-2.0\n\nusing System.Text.RegularExpressions;\nusing DocumentFormat.OpenXml.Packaging;\nusing DocumentFormat.OpenXml.Spreadsheet;\nusing OfficeCli.Core;\nusing X14 = DocumentFormat.OpenXml.Office2010.Excel;\n\nnamespace OfficeCli.Handlers;\n\npublic partial class ExcelHandler\n{\n    // ==================== Query Layer ====================\n\n    public DocumentNode Get(string path, int depth = 1)\n    {\n        if (string.IsNullOrEmpty(path))\n            throw new ArgumentException(\"Path cannot be empty.\");\n        path = NormalizeExcelPath(path);\n        path = ResolveSheetIndexInPath(path);\n        if (path == \"/\")\n        {\n            var node = new DocumentNode { Path = \"/\", Type = \"workbook\" };\n\n            // Core document properties\n            var props = _doc.PackageProperties;\n            if (props.Title != null) node.Format[\"title\"] = props.Title;\n            if (props.Creator != null) node.Format[\"author\"] = props.Creator;\n            if (props.Subject != null) node.Format[\"subject\"] = props.Subject;\n            if (props.Keywords != null) node.Format[\"keywords\"] = props.Keywords;\n            if (props.Description != null) node.Format[\"description\"] = props.Description;\n            if (props.Category != null) node.Format[\"category\"] = props.Category;\n            if (props.LastModifiedBy != null) node.Format[\"lastModifiedBy\"] = props.LastModifiedBy;\n            if (props.Revision != null) node.Format[\"revisionNumber\"] = props.Revision;\n            if (props.Created != null) node.Format[\"created\"] = props.Created.Value.ToString(\"o\");\n            if (props.Modified != null) node.Format[\"modified\"] = props.Modified.Value.ToString(\"o\");","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Query.cs#L1-L37","documentation":"Thrown by ExcelHandler.Get when the path argument is null or empty. Get is the universal read entry point and requires a non-empty path; an empty path has no meaning because even the workbook root is addressed by '/'.","triggerScenarios":"Calling Get(null), Get(\"\"), Get(\"   \") programmatically, or a CLI/dispatch layer that forwards an unset path variable.","commonSituations":"A templating layer interpolating an undefined path variable; an MCP/agent tool call with a missing 'path' field; a loop that occasionally yields an empty selector.","solutions":["Pass a concrete path; use '/' to address the workbook root.","In calling code, default the path to '/' when it is null or whitespace.","Validate path presence at the dispatch boundary before invoking Get."],"exampleFix":"// before\nvar node = excel.Get(path);   // path may be null/empty\n\n// after\nif (string.IsNullOrWhiteSpace(path)) path = \"/\";\nvar node = excel.Get(path);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(path))\n    path = \"/\";   // or throw at the dispatch boundary\nvar node = excel.Get(path);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default empty paths to '/' at the dispatch boundary.","Require a non-empty 'path' field in MCP/agent tool schemas.","Coalesce null path variables to '/' before calling Get."],"tags":["excel","validation","path","query"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}