{"record":{"id":"2b011466c51c1c24","repo":"iOfficeAI/OfficeCLI","slug":"unknown-element-type-type-for-parentpath-va","errorCode":null,"errorMessage":"Unknown element type '{type}' for {parentPath}. Valid types: sheet, row, cell, shape, chart, ole (object, embed), autofilter, databar, colorscale, iconset, formulacf, comment, namedrange, table, picture, validation, pivottable. Use 'officecli xlsx add' for details.","messagePattern":"Unknown element type '(.+?)' for (.+?)\\. Valid types: sheet, row, cell, shape, chart, ole \\(object, embed\\), autofilter, databar, colorscale, iconset, formulacf, comment, namedrange, table, picture, validation, pivottable\\. Use 'officecli xlsx add' for details\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs","lineNumber":453,"sourceCode":"        // Generic fallback: create typed element via SDK schema validation\n        // Parse parentPath: /<SheetName>/xmlPath...\n        var fbSegments = parentPath.TrimStart('/').Split('/', 2);\n        var fbSheetName = fbSegments[0];\n        var fbWorksheet = FindWorksheet(fbSheetName);\n        if (fbWorksheet == null)\n            throw new ArgumentException($\"Sheet not found: {fbSheetName}\");\n\n        OpenXmlElement fbParent = GetSheet(fbWorksheet);\n        if (fbSegments.Length > 1 && !string.IsNullOrEmpty(fbSegments[1]))\n        {\n            var xmlSegments = GenericXmlQuery.ParsePathSegments(fbSegments[1]);\n            fbParent = GenericXmlQuery.NavigateByPath(fbParent!, xmlSegments)\n                ?? throw new ArgumentException($\"Parent element not found: {parentPath}\");\n        }\n\n        var created = GenericXmlQuery.TryCreateTypedElement(fbParent!, type, properties, index);\n        if (created == null)\n            throw new ArgumentException(\n                $\"Unknown element type '{type}' for {parentPath}. \" +\n                \"Valid types: sheet, row, cell, shape, chart, ole (object, embed), autofilter, databar, colorscale, iconset, formulacf, comment, namedrange, table, picture, validation, pivottable. \" +\n                \"Use 'officecli xlsx add' for details.\");\n\n        SaveWorksheet(fbWorksheet);\n\n        var siblings = fbParent.ChildElements.Where(e => e.LocalName == created.LocalName).ToList();\n        var createdIdx = PathIndex.FromArrayIndex(siblings.IndexOf(created));\n        return $\"{parentPath}/{created.LocalName}[{createdIdx}]\";\n    }\n\n    // Write inline chartEx categories/values into the host sheet at A1..B(N+1).\n    // cx:f formulas in BuildExtendedChartSpace assume:\n    //   row 1     = headers (A1 empty, B1+ = series names)\n    //   rows 2..  = data (col A = categories, col B+ = series values)\n    private void WriteChartExInlineDataToSheet(\n        WorksheetPart worksheetPart,\n        string[]? categories,","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs#L435-L471","documentation":"Thrown by AddDefault when GenericXmlQuery.TryCreateTypedElement returns null, meaning the requested element type string is not recognized by the schema-driven factory. The error lists all valid type names so the user can self-correct without consulting separate docs.","triggerScenarios":"Calling add with --type set to a value not in the supported set: sheet, row, cell, shape, chart, ole, autofilter, databar, colorscale, iconset, formulacf, comment, namedrange, table, picture, validation, pivottable. Typos like 'cells', 'chart-series' (which is handled separately), or 'object' instead of 'ole' trigger this.","commonSituations":"User guesses a type name or uses a synonym (e.g. 'image' for 'picture', 'filter' for 'autofilter'). User uses a type valid in a different handler (Word/PPT) that Excel does not support. Copy-paste from outdated docs.","solutions":["Use one of the listed valid types: sheet, row, cell, shape, chart, ole, autofilter, databar, colorscale, iconset, formulacf, comment, namedrange, table, picture, validation, pivottable.","For OLE objects use 'ole' (not 'object' or 'embed').","For pictures use 'picture' (not 'image').","Run 'officecli xlsx add' with no arguments to see the usage/help."],"exampleFix":"// before\nadd /Sheet1 --type image --src logo.png\n// after\nadd /Sheet1 --type picture --src logo.png","handlingStrategy":"validation","validationCode":"// Validate the element type against the known set before calling AddDefault\nvar validTypes = new HashSet<string>(StringComparer.OrdinalIgnoreCase)\n{\n    \"sheet\", \"row\", \"cell\", \"shape\", \"chart\", \"ole\",\n    \"autofilter\", \"databar\", \"colorscale\", \"iconset\", \"formulacf\",\n    \"comment\", \"namedrange\", \"table\", \"picture\", \"validation\", \"pivottable\"\n};\nif (!validTypes.Contains(type))\n    throw new InvalidOperationException(\n        $\"Unknown element type '{type}'. Valid: {string.Join(\", \", validTypes.OrderBy(t => t))}.\");","typeGuard":"static readonly HashSet<string> ValidExcelAddTypes = new(StringComparer.OrdinalIgnoreCase)\n{\n    \"sheet\", \"row\", \"cell\", \"shape\", \"chart\", \"ole\",\n    \"autofilter\", \"databar\", \"colorscale\", \"iconset\", \"formulacf\",\n    \"comment\", \"namedrange\", \"table\", \"picture\", \"validation\", \"pivottable\"\n};\nstatic bool IsValidExcelAddType(string type) => ValidExcelAddTypes.Contains(type);","tryCatchPattern":"try { handler.AddDefault(parentPath, type, position, properties); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"Unknown element type\"))\n{\n    Console.Error.WriteLine(ex.Message);\n}","preventionTips":["Use only the documented type names: sheet, row, cell, shape, chart, ole, autofilter, databar, colorscale, iconset, formulacf, comment, namedrange, table, picture, validation, pivottable.","Use 'ole' for OLE objects (not 'object' or 'embed').","Use 'picture' for images (not 'image').","Run 'officecli xlsx add' for the help listing of valid types."],"tags":["excel","add","unknown-type","validation","schema"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}