Skip to content

troubleshooting

zmworm edited this page Mar 31, 2026 · 23 revisions

Troubleshooting

Common errors and solutions for OfficeCLI.


Common Errors

"Sheet not found: {name}"

Cause: Sheet name doesn't match exactly. Sheet names are case-sensitive. Solution: Use officecli get file.xlsx / to list actual sheet names, then use the exact name shown.

"Element not found at path: {path}"

Cause: The specified path doesn't exist in the document. Solution: Use officecli get file /path --depth 2 to explore available children. Remember that indices are 1-based (e.g., /Sheet1/row[1] is the first row).

"Unsupported property: {key} (valid props: ...)"

Cause: The property is not supported for this element type. Solution: The error message now includes a list of valid properties for the element. Use the suggested property names directly. Property keys are case-insensitive. For the full property reference, check the element's -set or -add wiki page.

"Either --type or --from must be specified"

Cause: The add command requires a --type flag to know what kind of element to create. Solution: Add --type <element-type> to your command, or use --from <file> to add from an existing source.

"File is held by resident process"

Cause: Trying to create or overwrite a file that has an active resident process. Solution: Use officecli close file first to release the file, then retry your command.

"Named range '{name}' not found"

Cause: The named range doesn't exist in the workbook. Solution: Use officecli get file.xlsx / and check the namedrange entries to see available named ranges.

"Validation index out of range"

Cause: The validation index you specified doesn't exist. Solution: Use officecli get file.xlsx /SheetName to see how many validations exist before referencing by index.

"Table index out of range"

Cause: The table index you specified doesn't exist. Solution: Use officecli get file.xlsx /SheetName to see how many tables exist before referencing by index.

Document opens but looks wrong after modification

Cause: Usually a validation error in the document structure. Solution: Run officecli validate file to check for issues. Common causes include invalid XML in raw-set or wrong property values.

"Picture/image file not found"

Cause: The file path is relative to where officecli is run, not relative to the document. Solution: Use absolute paths for image files, or ensure your working directory is correct.

Resident process not responding

Cause: The resident process may have crashed or timed out (12 min idle timeout). Solution: Just run commands directly -- they auto-fallback to non-resident mode. Or use officecli open file to restart the resident process.

"No data validations found in sheet"

Cause: Trying to set or get validation[N] but no validations exist in the sheet. Solution: Add a validation first before trying to reference one by index.

Batch command partially failed

Cause: By default, batch mode continues on error. Solution: Check output for [N] ERROR: lines to identify which commands failed. Use --stop-on-error to halt on the first failure.

Numbers showing as text in Excel

Cause: Cell values are stored as text instead of numbers. Solution: Set --prop type=number or ensure the value is numeric. Check the current type with officecli get file.xlsx /Sheet1/A1.

Merge cells not working

Cause: Using a single cell path instead of a range path. Solution: Use a range path: officecli set file.xlsx /Sheet1/A1:D1 --prop merge=true, not a single cell path.


General Debugging Steps

  1. Use view outline to understand the document structure
  2. Use get / --depth 2 to explore paths
  3. Use query to find elements
  4. Use validate after modifications
  5. Use raw to inspect XML when high-level commands don't explain the issue

Tips

  • Always get before set to verify the path exists
  • Use --json for programmatic parsing — all commands return a { "success": true/false, ... } envelope
  • On error with --json, check error.code and error.suggestion for machine-readable details
  • Use batch mode for multiple changes (atomic, faster)
  • Use resident mode for interactive workflows
  • Path indices are 1-based, --index parameter is 0-based
  • Colors are hex without #: FF0000 not #FF0000
  • Dimensions accept unit suffixes: 2cm, 1in, 12pt
  • Image path/src accepts local files, data:image/...;base64,... data URIs, or https://... URLs
  • Use officecli mcp <target> to register as MCP server in AI clients

Based on OfficeCLI v1.0.28

Clone this wiki locally