@sheetpane/mcp 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ERRORS.md ADDED
@@ -0,0 +1,811 @@
1
+ ---
2
+ type: Reference
3
+ description: "Every SP code sheetpane raises — what it means, the likely cause, the fix, and the record it comes from."
4
+ ---
5
+
6
+ # Error codes
7
+
8
+ **Every message sheetpane shows a host carries a stable code.** A thrown
9
+ error, a console line, a rules-file note, a refused load or a blocked edit
10
+ reads `SP-3012: Plugin derive failed — … (…/ERRORS.md#sp-3012)`.
11
+
12
+ **A code is permanent.** It is never renumbered and never reused. A code no
13
+ longer raised stays in the registry, marked *retired*.
14
+
15
+ **The registry is code.** `CODES` in
16
+ [`packages/export/src/codes.ts`](../packages/export/src/codes.ts) holds each
17
+ code's title and severity; this page holds the long text. The repo test
18
+ `test/error-codes.test.ts` fails when the two disagree.
19
+
20
+ ## Where the code is
21
+
22
+ | surface | where to read it |
23
+ |---|---|
24
+ | a thrown error | `err.spCode` on every one; `err.code` too, except on `ExportError` and `ImportError`, whose `code` stays the typed reason (`corrupt`, `password-or-legacy`, …) |
25
+ | a console warning or error | the text starts with the code and ends with the link to this page |
26
+ | a rules-engine note (`SheetpaneError`) | `error.code` — optional, so a v1 error without it stays valid |
27
+ | `sheetpane-load` with `status: 'error'` | `detail.spCode` (`detail.code` stays the reader's reason) |
28
+ | `sheetpane-editcancel` with `reason: 'blocked'` | `detail.code` |
29
+ | anything above | `codeOf(x)` from `@sheetpane/export` (or `@sheetpane/grid`) returns the code, or `undefined` |
30
+
31
+ ## Ranges
32
+
33
+ | range | package |
34
+ |---|---|
35
+ | 1xxx | `@sheetpane/import` — reading a file |
36
+ | 2xxx | `@sheetpane/export` — writing a file, the ZIP walk, `download()` (21xx) |
37
+ | 3xxx | `@sheetpane/grid` — the store, the plugin host, `<sheetpane-excel>` |
38
+ | 4xxx | `<sheetpane-errors>` — none raised yet |
39
+ | 5xxx | plugins — 5100 numfmt · 5200 formulas · 5300 styles · 5400 validation · 5500 condfmt · 5600 images · 5700 charts · 5800 comments |
40
+ | 6xxx | column rules and the rules file |
41
+ | 7xxx | `@sheetpane/mcp` — reserved |
42
+
43
+ ## Index
44
+
45
+ <!-- index:start — generated from CODES by test/error-codes.test.ts; run `SP_WRITE_ERRORS_DOC=1 pnpm exec vitest run --project repo` to rewrite it -->
46
+ | code | title | severity |
47
+ |---|---|---|
48
+ | [SP-1001](#sp-1001) | Not an .xlsx or .csv file | error |
49
+ | [SP-1002](#sp-1002) | Password-protected workbook | error |
50
+ | [SP-1003](#sp-1003) | Legacy .xls workbook | error |
51
+ | [SP-1004](#sp-1004) | Encrypted or OLE file | error |
52
+ | [SP-1005](#sp-1005) | Not a workbook | error |
53
+ | [SP-1006](#sp-1006) | File too large | error |
54
+ | [SP-1007](#sp-1007) | Damaged file | error |
55
+ | [SP-1008](#sp-1008) | Reading .xlsx needs a DOM (retired) | error |
56
+ | [SP-2001](#sp-2001) | Invalid sheet name | error |
57
+ | [SP-2002](#sp-2002) | No visible sheet | error |
58
+ | [SP-2003](#sp-2003) | Sheet past Excel’s limits | error |
59
+ | [SP-2004](#sp-2004) | Not a cell reference | error |
60
+ | [SP-2005](#sp-2005) | Value a workbook cannot store | error |
61
+ | [SP-2006](#sp-2006) | No such sheet | error |
62
+ | [SP-2007](#sp-2007) | Invalid merge | error |
63
+ | [SP-2008](#sp-2008) | Not a ZIP archive | error |
64
+ | [SP-2009](#sp-2009) | ZIP64 archive refused | error |
65
+ | [SP-2010](#sp-2010) | Encrypted ZIP entry | error |
66
+ | [SP-2011](#sp-2011) | Unsupported ZIP compression | error |
67
+ | [SP-2012](#sp-2012) | Damaged archive | error |
68
+ | [SP-2013](#sp-2013) | Archive over the size limit | error |
69
+ | [SP-2014](#sp-2014) | Not a workbook package | error |
70
+ | [SP-2101](#sp-2101) | download() needs a file name | error |
71
+ | [SP-2102](#sp-2102) | Only .xlsx or .csv can be saved | error |
72
+ | [SP-2103](#sp-2103) | File type cannot be told | error |
73
+ | [SP-2104](#sp-2104) | Text cannot be saved as .xlsx | error |
74
+ | [SP-2105](#sp-2105) | File name is empty once cleaned | error |
75
+ | [SP-2106](#sp-2106) | download() needs a browser page | error |
76
+ | [SP-2107](#sp-2107) | download() data type not accepted | error |
77
+ | [SP-3001](#sp-3001) | Nothing is loaded to export | error |
78
+ | [SP-3002](#sp-3002) | Unknown plugin | error |
79
+ | [SP-3003](#sp-3003) | Not a plugin | error |
80
+ | [SP-3004](#sp-3004) | Plugin listed twice | error |
81
+ | [SP-3005](#sp-3005) | Plugin hook without its function | error |
82
+ | [SP-3006](#sp-3006) | Hook has one provider per pane | error |
83
+ | [SP-3007](#sp-3007) | Duplicate control id | error |
84
+ | [SP-3008](#sp-3008) | Unknown control slot | error |
85
+ | [SP-3009](#sp-3009) | Decorate order loops | error |
86
+ | [SP-3010](#sp-3010) | Plugin set a font family | error |
87
+ | [SP-3011](#sp-3011) | Plugin set fixed per pane | warning |
88
+ | [SP-3012](#sp-3012) | Plugin derive failed | error |
89
+ | [SP-3013](#sp-3013) | Plugin validate failed | error |
90
+ | [SP-3014](#sp-3014) | Plugin overlay failed | error |
91
+ | [SP-3015](#sp-3015) | Source could not be read | error |
92
+ | [SP-5101](#sp-5101) | Selection too large to format | warning |
93
+ | [SP-5102](#sp-5102) | Not a style sheet | error |
94
+ | [SP-5103](#sp-5103) | Workbook has no style sheet | error |
95
+ | [SP-5201](#sp-5201) | Recalculation failed | error |
96
+ | [SP-5202](#sp-5202) | Formula engine did not load | error |
97
+ | [SP-5701](#sp-5701) | Chart part is not well-formed XML | error |
98
+ | [SP-5702](#sp-5702) | Chart part holds no chart | error |
99
+ | [SP-5801](#sp-5801) | Comment part has no container | error |
100
+ | [SP-5802](#sp-5802) | Not a worksheet | error |
101
+ | [SP-5803](#sp-5803) | Comments not written for a sheet | error |
102
+ | [SP-6001](#sp-6001) | Column rule pattern is not a regular expression | error |
103
+ | [SP-6002](#sp-6002) | Column-rules validate function failed | error |
104
+ | [SP-6003](#sp-6003) | Value refused by a rule | warning |
105
+ | [SP-6010](#sp-6010) | Rules file is not a JSON object | note |
106
+ | [SP-6011](#sp-6011) | Rules file could not be read | note |
107
+ | [SP-6012](#sp-6012) | Unknown rules file version | note |
108
+ | [SP-6013](#sp-6013) | Unknown key in the rules file | note |
109
+ | [SP-6014](#sp-6014) | Rules file has no sheets | note |
110
+ | [SP-6015](#sp-6015) | Rule is not an object | note |
111
+ | [SP-6016](#sp-6016) | Unknown rule word | note |
112
+ | [SP-6017](#sp-6017) | Unknown rule type | note |
113
+ | [SP-6018](#sp-6018) | Rules file pattern is not a regular expression | note |
114
+ | [SP-6019](#sp-6019) | Rule list is not a list | note |
115
+ | [SP-6020](#sp-6020) | Header row is not a row number | note |
116
+ | [SP-6021](#sp-6021) | Not a cell or a range | note |
117
+ | [SP-6022](#sp-6022) | Rules name a missing sheet | note |
118
+ | [SP-6023](#sp-6023) | No column has this title | note |
119
+ | [SP-6024](#sp-6024) | Two columns share a title | note |
120
+ | [SP-6025](#sp-6025) | Rules file rule replaces the element’s | note |
121
+ | [SP-7001](#sp-7001) | Tool input is missing or malformed | error |
122
+ | [SP-7002](#sp-7002) | No file at that path | error |
123
+ | [SP-7003](#sp-7003) | File too large for the tool | error |
124
+ | [SP-7004](#sp-7004) | Workbook could not be read | error |
125
+ | [SP-7005](#sp-7005) | No sheet by that name | error |
126
+ | [SP-7006](#sp-7006) | Not a sheetpane code | error |
127
+ | [SP-7007](#sp-7007) | Server data file missing | error |
128
+ <!-- index:end -->
129
+
130
+ ---
131
+
132
+ ## 1xxx · import
133
+
134
+ Raised by `read()`, `fromXlsx()` and `fromCsv()` as an `ImportError`; the
135
+ grid shows it as "Can't open this file" (or the password state) and fires
136
+ `sheetpane-load` with `status: 'error'`.
137
+
138
+ ### SP-1001
139
+
140
+ **Not an .xlsx or .csv file** · error · [SR-IMPORT](../records/0104_IMPORT.md) · [SR-LAW-3](../records/0005_LAW-3-xlsx-and-csv-only.md) · `code: 'unsupported-format'`
141
+
142
+ - **Meaning:** sheetpane opens `.xlsx` and `.csv` only, and this file is neither.
143
+ - **Likely cause:** a `.xls`, `.xlsm`, `.xlsb`, `.ods`, `.numbers` or `.tsv` file; a ZIP named `.csv`; binary bytes with no name.
144
+ - **Fix:** save the file as `.xlsx` or `.csv` in the program that made it, then open it again.
145
+
146
+ ### SP-1002
147
+
148
+ **Password-protected workbook** · error · [SR-IMPORT](../records/0104_IMPORT.md) · `code: 'password-or-legacy'`, `detail: 'password'`
149
+
150
+ - **Meaning:** the file is an encrypted `.xlsx` (an OLE file holding an `EncryptedPackage`).
151
+ - **Likely cause:** the workbook was saved with a password to open.
152
+ - **Fix:** remove the password in Excel (File → Info → Protect Workbook), save, and open it again.
153
+
154
+ ### SP-1003
155
+
156
+ **Legacy .xls workbook** · error · [SR-IMPORT](../records/0104_IMPORT.md) · `code: 'password-or-legacy'`, `detail: 'legacy'`
157
+
158
+ - **Meaning:** the file is an OLE compound file without an encrypted package — the pre-2007 `.xls` format.
159
+ - **Likely cause:** an old workbook, or a `.xls` renamed to `.xlsx`.
160
+ - **Fix:** open it in Excel and save it as `.xlsx` or `.csv`.
161
+
162
+ ### SP-1004
163
+
164
+ **Encrypted or OLE file** · error · [SR-IMPORT](../records/0104_IMPORT.md) · `code: 'password-or-legacy'`
165
+
166
+ - **Meaning:** the file is encrypted, but which kind cannot be told.
167
+ - **Likely cause:** a ZIP whose entries are encrypted (ZIP-level password).
168
+ - **Fix:** remove the password and save the workbook as a plain `.xlsx`.
169
+
170
+ ### SP-1005
171
+
172
+ **Not a workbook** · error · [SR-IMPORT](../records/0104_IMPORT.md) · `code: 'not-workbook'`
173
+
174
+ - **Meaning:** the bytes are not an `.xlsx` workbook.
175
+ - **Likely cause:** a ZIP with no `xl/workbook.xml`, text named `.xlsx`, a workbook with no worksheets, or a file cut short in transfer.
176
+ - **Fix:** check the file opens in Excel; re-download or re-export it.
177
+
178
+ ### SP-1006
179
+
180
+ **File too large** · error · [SR-IMPORT](../records/0104_IMPORT.md) · `code: 'too-large'`
181
+
182
+ - **Meaning:** the file is past a limit the reader keeps.
183
+ - **Likely cause:** a ZIP64 archive; a part over 512 MB or 1 GB in all inflated; more than 1,048,576 rows or 16,384 columns (Excel's own limits).
184
+ - **Fix:** split the workbook, or remove unused rows and columns, and save it again.
185
+
186
+ ### SP-1007
187
+
188
+ **Damaged file** · error · [SR-IMPORT](../records/0104_IMPORT.md) · `code: 'corrupt'`
189
+
190
+ - **Meaning:** the file is a workbook, but part of it cannot be read.
191
+ - **Likely cause:** bad DEFLATE data, a CRC mismatch, XML that is not well-formed, a sheet pointing at a missing part.
192
+ - **Fix:** open and re-save it in Excel, which repairs most damage; then open it again.
193
+
194
+ ### SP-1008
195
+
196
+ **Reading .xlsx needs a DOM** · error · **retired** · [SR-IMPORT](../records/0104_IMPORT.md) decision 8
197
+
198
+ - **Meaning:** no longer raised. `.xlsx` once needed `DOMParser`; since W-39 the reader carries its own XML parser for runtimes without one, so `.xlsx` reads in Node, workers and server renders.
199
+ - **Likely cause:** an older `@sheetpane/import`.
200
+ - **Fix:** upgrade `@sheetpane/import`. The code is kept so it is never reused.
201
+
202
+ ---
203
+
204
+ ## 2xxx · export
205
+
206
+ Raised by `toXlsx()`, `patchXlsx()`, `toCsv()` and the ZIP walk as an
207
+ `ExportError` (`sheet` and `ref` name where); `download()` errors (21xx) are
208
+ plain `Error`s or `TypeError`s.
209
+
210
+ ### SP-2001
211
+
212
+ **Invalid sheet name** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'sheet-name'`
213
+
214
+ - **Meaning:** a sheet name breaks Excel's rules.
215
+ - **Likely cause:** empty or over 31 characters; contains `[ ] : * ? / \`; starts or ends with `'`; used twice (case is ignored).
216
+ - **Fix:** rename the sheet; `checkSheetName()` tells you before you export.
217
+
218
+ ### SP-2002
219
+
220
+ **No visible sheet** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'sheet-count'`
221
+
222
+ - **Meaning:** a workbook needs at least one sheet, and at least one visible.
223
+ - **Likely cause:** `sheets: []`, or every sheet `hidden: true`; or a `patchXlsx` `hidden` option that would leave no sheet `visible`.
224
+ - **Fix:** add a sheet, or un-hide one.
225
+
226
+ ### SP-2003
227
+
228
+ **Sheet past Excel’s limits** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'too-large'`
229
+
230
+ - **Meaning:** a sheet has more than 1,048,576 rows or a row more than 16,384 columns.
231
+ - **Likely cause:** data larger than a worksheet holds; `ref` names the first cell past the limit.
232
+ - **Fix:** split the data across sheets, or export CSV.
233
+
234
+ ### SP-2004
235
+
236
+ **Not a cell reference** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'bad-ref'`
237
+
238
+ - **Meaning:** a change names a `ref` that is not an A1 cell.
239
+ - **Likely cause:** `A0`, a range, or a typo in a `patchXlsx` change; or a `patchXlsx` `hidden` row or column index that is not a whole number from 0 to 1,048,575 (rows) or 16,383 (columns).
240
+ - **Fix:** pass one A1 cell per change (`B7`).
241
+
242
+ ### SP-2005
243
+
244
+ **Value a workbook cannot store** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'bad-value'`
245
+
246
+ - **Meaning:** a cell holds something a workbook cell cannot.
247
+ - **Likely cause:** `NaN` or `Infinity`; text over 32,767 characters; an object or `undefined`; `rows` not an array of arrays; a `patchXlsx` `hidden` outline level outside 0–7 or a `state` other than `visible`, `hidden`, `veryHidden`.
248
+ - **Fix:** store text, a finite number, a boolean or `null`; the message names the cell.
249
+
250
+ ### SP-2006
251
+
252
+ **No such sheet** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'no-sheet'`
253
+
254
+ - **Meaning:** a change, merge or freeze names a sheet the workbook lacks.
255
+ - **Likely cause:** a renamed sheet, or a typo in the sheet name.
256
+ - **Fix:** use the exact sheet name from the workbook.
257
+
258
+ ### SP-2007
259
+
260
+ **Invalid merge** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'bad-merge'`
261
+
262
+ - **Meaning:** a merge is not a range of two or more cells, or overlaps another merge.
263
+ - **Likely cause:** a single cell given as a merge; two merges that share a cell.
264
+ - **Fix:** give `A1:C1`-style ranges that do not overlap.
265
+
266
+ ### SP-2008
267
+
268
+ **Not a ZIP archive** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'not-zip'`
269
+
270
+ - **Meaning:** no end-of-central-directory record was found.
271
+ - **Likely cause:** the bytes are not a ZIP (not an `.xlsx`), or were cut short.
272
+ - **Fix:** pass the original `.xlsx` bytes, unmodified.
273
+
274
+ ### SP-2009
275
+
276
+ **ZIP64 archive refused** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'zip64'`
277
+
278
+ - **Meaning:** the archive uses ZIP64, which sheetpane does not read.
279
+ - **Likely cause:** a package over 4 GB or 65,534 entries, or a tool that always writes ZIP64.
280
+ - **Fix:** re-save the workbook in Excel, which writes plain ZIP for normal sizes.
281
+
282
+ ### SP-2010
283
+
284
+ **Encrypted ZIP entry** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'encrypted'`
285
+
286
+ - **Meaning:** a ZIP entry is encrypted.
287
+ - **Likely cause:** the package was zipped with a password.
288
+ - **Fix:** re-save the workbook without a password.
289
+
290
+ ### SP-2011
291
+
292
+ **Unsupported ZIP compression** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'unsupported-compression'`
293
+
294
+ - **Meaning:** an entry uses a method other than store or DEFLATE.
295
+ - **Likely cause:** a tool that re-zipped the package with BZIP2, LZMA or similar.
296
+ - **Fix:** re-save the workbook in Excel.
297
+
298
+ ### SP-2012
299
+
300
+ **Damaged archive** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'corrupt'`
301
+
302
+ - **Meaning:** the archive or a part in it is damaged.
303
+ - **Likely cause:** a broken central directory or local header, an entry past the end, bad DEFLATE data, a CRC-32 mismatch, an unclosed row or `<sheetData>`.
304
+ - **Fix:** re-save the workbook in Excel; re-download it if it came over a network.
305
+
306
+ ### SP-2013
307
+
308
+ **Archive over the size limit** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'over-limit'`
309
+
310
+ - **Meaning:** reading would inflate past a cap, or writing would need ZIP64.
311
+ - **Likely cause:** a part over `maxEntrySize` (512 MB) or the whole over `maxTotalSize` (1 GB); a written archive over 4 GB or 65,534 entries.
312
+ - **Fix:** split the workbook; when calling `readZip` / `inflateEntry` yourself, raise their `limits` only for files you trust.
313
+
314
+ ### SP-2014
315
+
316
+ **Not a workbook package** · error · [SR-EXPORT](../records/0103_EXPORT.md) · `code: 'not-workbook'`
317
+
318
+ - **Meaning:** `patchXlsx` was given a ZIP with no `xl/workbook.xml`.
319
+ - **Likely cause:** the upload was not an `.xlsx`, or the wrong bytes were passed.
320
+ - **Fix:** pass the original workbook's bytes.
321
+
322
+ ### SP-2101
323
+
324
+ **download() needs a file name** · error · [SR-DOWNLOAD](../records/0101_DOWNLOAD.md) · `TypeError`
325
+
326
+ - **Meaning:** the second argument of `download()` is not a string.
327
+ - **Likely cause:** `download(bytes)` with no name.
328
+ - **Fix:** `download(bytes, 'report.xlsx')`.
329
+
330
+ ### SP-2102
331
+
332
+ **Only .xlsx or .csv can be saved** · error · [SR-DOWNLOAD](../records/0101_DOWNLOAD.md) · [SR-LAW-3](../records/0005_LAW-3-xlsx-and-csv-only.md)
333
+
334
+ - **Meaning:** the file name ends in an extension other than `.xlsx` or `.csv`.
335
+ - **Likely cause:** `report.pdf`, `data.xls`.
336
+ - **Fix:** name the file `.xlsx` or `.csv`, or leave the extension off.
337
+
338
+ ### SP-2103
339
+
340
+ **File type cannot be told** · error · [SR-DOWNLOAD](../records/0101_DOWNLOAD.md)
341
+
342
+ - **Meaning:** no extension was given and the Blob's type is neither `.xlsx` nor CSV.
343
+ - **Likely cause:** a Blob made without a `type`.
344
+ - **Fix:** add `.xlsx` or `.csv` to the name.
345
+
346
+ ### SP-2104
347
+
348
+ **Text cannot be saved as .xlsx** · error · [SR-DOWNLOAD](../records/0101_DOWNLOAD.md)
349
+
350
+ - **Meaning:** a string was passed with an `.xlsx` name.
351
+ - **Likely cause:** `toCsv()` output saved under an `.xlsx` name.
352
+ - **Fix:** save text as `.csv`, or pass `toXlsx()` bytes.
353
+
354
+ ### SP-2105
355
+
356
+ **File name is empty once cleaned** · error · [SR-DOWNLOAD](../records/0101_DOWNLOAD.md)
357
+
358
+ - **Meaning:** removing unsafe characters, spaces and dots left no name.
359
+ - **Likely cause:** a name like ` .xlsx`.
360
+ - **Fix:** give a name with letters or digits.
361
+
362
+ ### SP-2106
363
+
364
+ **download() needs a browser page** · error · [SR-DOWNLOAD](../records/0101_DOWNLOAD.md)
365
+
366
+ - **Meaning:** there is no `document` to click a download link in.
367
+ - **Likely cause:** `download()` called in Node, a worker or a server render.
368
+ - **Fix:** write the bytes yourself there (`fs.writeFile`); call `download()` only in a page.
369
+
370
+ ### SP-2107
371
+
372
+ **download() data type not accepted** · error · [SR-DOWNLOAD](../records/0101_DOWNLOAD.md) · `TypeError`
373
+
374
+ - **Meaning:** the first argument is not a `Uint8Array`, a `Blob` or a string.
375
+ - **Likely cause:** an `ArrayBuffer`, a number, or a `Promise` not awaited.
376
+ - **Fix:** pass `await toXlsx(…)`, `toCsv(…).text`, or a `Blob`.
377
+
378
+ ---
379
+
380
+ ## 3xxx · grid
381
+
382
+ The store, the plugin host and `<sheetpane-excel>`.
383
+
384
+ ### SP-3001
385
+
386
+ **Nothing is loaded to export** · error · [SR-GRID](../records/0105_GRID.md) decision 6
387
+
388
+ - **Meaning:** `exportFile()` (or the element's `export()`) ran with no workbook in the pane.
389
+ - **Likely cause:** export called before `load()` settled, or after a refused load.
390
+ - **Fix:** wait for `sheetpane-load` with `status: 'ready'` before exporting.
391
+
392
+ ### SP-3002
393
+
394
+ **Unknown plugin** · error · [SR-GRID](../records/0105_GRID.md) decision 18
395
+
396
+ - **Meaning:** the `plugins` attribute names an id no package has registered.
397
+ - **Likely cause:** the plugin's package was not imported, or was imported after the element connected; a typo in the id.
398
+ - **Fix:** `import '@sheetpane/<plugin>'` before the element is in the page.
399
+
400
+ ### SP-3003
401
+
402
+ **Not a plugin** · error · [SR-GRID](../records/0105_GRID.md) decision 17
403
+
404
+ - **Meaning:** an entry in the plugin list is not `{ id, provides: [...] }`.
405
+ - **Likely cause:** a factory called twice, a missing `provides` array, `undefined` in the list.
406
+ - **Fix:** pass plugin objects — `numfmt()`, not `numfmt`.
407
+
408
+ ### SP-3004
409
+
410
+ **Plugin listed twice** · error · [SR-GRID](../records/0105_GRID.md) decision 17
411
+
412
+ - **Meaning:** two plugins in one pane share an id.
413
+ - **Likely cause:** the same plugin passed twice to `createWorkbook({ plugins })`.
414
+ - **Fix:** list each plugin once.
415
+
416
+ ### SP-3005
417
+
418
+ **Plugin hook without its function** · error · [SR-GRID](../records/0105_GRID.md) decision 17
419
+
420
+ - **Meaning:** a plugin's `provides` names a hook it does not implement.
421
+ - **Likely cause:** `provides: ['format']` with no `format()` method.
422
+ - **Fix:** implement the hook, or remove it from `provides`.
423
+
424
+ ### SP-3006
425
+
426
+ **Hook has one provider per pane** · error · [SR-GRID](../records/0105_GRID.md) decision 17
427
+
428
+ - **Meaning:** two plugins provide `format` or `derive`, which have one provider per pane.
429
+ - **Likely cause:** two number-format or two formula plugins in one pane.
430
+ - **Fix:** keep one; the message names both.
431
+
432
+ ### SP-3007
433
+
434
+ **Duplicate control id** · error · [SR-GRID](../records/0105_GRID.md) decision 19
435
+
436
+ - **Meaning:** two controls in one pane share an id.
437
+ - **Likely cause:** two plugins (or one plugin listed twice) adding the same control.
438
+ - **Fix:** give each control a unique id.
439
+
440
+ ### SP-3008
441
+
442
+ **Unknown control slot** · error · [SR-GRID](../records/0105_GRID.md) decision 19
443
+
444
+ - **Meaning:** a control names a slot the grid does not have.
445
+ - **Likely cause:** a typo, or a slot from a newer grid.
446
+ - **Fix:** use one of `SLOTS` (`format-row`, `selbar`, `cellbar`, `status`, `cell`, `overlay`).
447
+
448
+ ### SP-3009
449
+
450
+ **Decorate order loops** · error · [SR-GRID](../records/0105_GRID.md) decision 17
451
+
452
+ - **Meaning:** the `after` lists of `decorate` plugins form a cycle.
453
+ - **Likely cause:** plugin A runs after B and B after A.
454
+ - **Fix:** break the cycle in one plugin's `after`; the message shows the loop.
455
+
456
+ ### SP-3010
457
+
458
+ **Plugin set a font family** · error · [SR-LAW-5](../records/0007_LAW-5-host-font.md) · [SR-GRID](../records/0105_GRID.md) decision 17
459
+
460
+ - **Meaning:** a `decorate` result named `font-family`; the host's font is the font.
461
+ - **Likely cause:** a plugin copying a workbook's font into the cell style.
462
+ - **Fix:** drop `font-family` from the plugin's `decorate` result.
463
+
464
+ ### SP-3011
465
+
466
+ **Plugin set fixed per pane** · warning · [SR-GRID](../records/0105_GRID.md) decision 18
467
+
468
+ - **Meaning:** a later element named a different plugin set for a pane that already exists; it is ignored.
469
+ - **Likely cause:** `<sheetpane-errors pane="q3" plugins="…">` disagreeing with the sheet's `plugins`.
470
+ - **Fix:** give every element of one pane the same `plugins`, or set it on the first only.
471
+
472
+ ### SP-3012
473
+
474
+ **Plugin derive failed** · error · [SR-GRID](../records/0105_GRID.md) decision 17
475
+
476
+ - **Meaning:** a plugin's `derive` threw or rejected; derived values were not updated.
477
+ - **Likely cause:** a bug in the plugin, or a cell it did not expect.
478
+ - **Fix:** read the error logged after this line; report it to the plugin's author.
479
+
480
+ ### SP-3013
481
+
482
+ **Plugin validate failed** · error · [SR-GRID](../records/0105_GRID.md) decision 17
483
+
484
+ - **Meaning:** a plugin's `validate` threw for a sheet; that sheet's errors from it were not updated.
485
+ - **Likely cause:** a bug in the plugin, or a rule it cannot read.
486
+ - **Fix:** read the error logged after this line; report it to the plugin's author.
487
+
488
+ ### SP-3014
489
+
490
+ **Plugin overlay failed** · error · [SR-GRID](../records/0105_GRID.md) decision 19a
491
+
492
+ - **Meaning:** a plugin's `overlay` threw; its items are not drawn.
493
+ - **Likely cause:** a bug in the plugin, or a drawing it cannot place.
494
+ - **Fix:** read the error logged after this line; report it to the plugin's author.
495
+
496
+ ### SP-3015
497
+
498
+ **Source could not be read** · error · [SR-GRID](../records/0105_GRID.md) decision 9 · `code: 'unreadable'`
499
+
500
+ - **Meaning:** the `src` URL (or `load(url)`) could not be fetched; the pane shows "Can't open this file".
501
+ - **Likely cause:** a 404 or 403; a cross-origin URL without CORS; invalid base64.
502
+ - **Fix:** check the URL opens in the browser and is same-origin or CORS-enabled.
503
+
504
+ ---
505
+
506
+ ## 4xxx · the errors element
507
+
508
+ `<sheetpane-errors>` raises no code yet; the range is held for it.
509
+
510
+ ---
511
+
512
+ ## 5xxx · plugins
513
+
514
+ ### SP-5101
515
+
516
+ **Selection too large to format** · warning · [SR-NUMFMT](../records/0109_NUMFMT.md)
517
+
518
+ - **Meaning:** a number-format action reached its cell cap; only the first cells were formatted.
519
+ - **Likely cause:** a format applied to whole columns or a very large range.
520
+ - **Fix:** select the cells that hold data, and apply again.
521
+
522
+ ### SP-5102
523
+
524
+ **Not a style sheet** · error · [SR-NUMFMT](../records/0109_NUMFMT.md)
525
+
526
+ - **Meaning:** `xl/styles.xml` holds no `<styleSheet>`, so number formats cannot be written.
527
+ - **Likely cause:** a damaged workbook, or a tool that wrote an empty styles part.
528
+ - **Fix:** re-save the workbook in Excel and export again.
529
+
530
+ ### SP-5103
531
+
532
+ **Workbook has no style sheet** · error · [SR-NUMFMT](../records/0109_NUMFMT.md)
533
+
534
+ - **Meaning:** the package lacks its styles part, so number formats cannot be written.
535
+ - **Likely cause:** a minimal workbook written by a script.
536
+ - **Fix:** re-save the workbook in Excel, which adds the part.
537
+
538
+ ### SP-5201
539
+
540
+ **Recalculation failed** · error · [SR-FORMULAS](../records/0111_FORMULAS.md)
541
+
542
+ - **Meaning:** the formula engine failed while recalculating; the saved values stay until the next workbook.
543
+ - **Likely cause:** a formula or function the engine cannot evaluate.
544
+ - **Fix:** read the error logged after this line; reload the workbook.
545
+
546
+ ### SP-5202
547
+
548
+ **Formula engine did not load** · error · [SR-FORMULAS](../records/0111_FORMULAS.md)
549
+
550
+ - **Meaning:** the WASM engine could not be fetched or started (with `preload`).
551
+ - **Likely cause:** the `.wasm` file is not served, a wrong `wasm` option, or a CSP blocking WebAssembly.
552
+ - **Fix:** serve the engine's `.wasm`, pass its URL as `wasm`, and allow `wasm-unsafe-eval` in the CSP.
553
+
554
+ ### SP-5701
555
+
556
+ **Chart part is not well-formed XML** · error · [SR-CHARTS](../records/0113_CHARTS.md)
557
+
558
+ - **Meaning:** a chart part cannot be parsed; the chart is not drawn.
559
+ - **Likely cause:** a damaged workbook.
560
+ - **Fix:** re-save the workbook in Excel.
561
+
562
+ ### SP-5702
563
+
564
+ **Chart part holds no chart** · error · [SR-CHARTS](../records/0113_CHARTS.md)
565
+
566
+ - **Meaning:** a chart part has no `c:chart` element; the chart is not drawn.
567
+ - **Likely cause:** a chart type sheetpane does not read, or a damaged part.
568
+ - **Fix:** re-save the workbook in Excel; check the chart opens there.
569
+
570
+ ### SP-5801
571
+
572
+ **Comment part has no container** · error · [SR-COMMENTS](../records/0112_COMMENTS.md)
573
+
574
+ - **Meaning:** a comments part the file already has lacks its root element, so it cannot be extended.
575
+ - **Likely cause:** a damaged comments or threaded-comments part.
576
+ - **Fix:** re-save the workbook in Excel; that sheet's comments are skipped (`unreadable-part`).
577
+
578
+ ### SP-5802
579
+
580
+ **Not a worksheet** · error · [SR-COMMENTS](../records/0112_COMMENTS.md)
581
+
582
+ - **Meaning:** a sheet part has no `<worksheet>`, so comments cannot be anchored in it.
583
+ - **Likely cause:** a chart sheet or a damaged sheet part.
584
+ - **Fix:** comments live on worksheets only; that sheet's comments are skipped.
585
+
586
+ ### SP-5803
587
+
588
+ **Comments not written for a sheet** · error · [SR-COMMENTS](../records/0112_COMMENTS.md)
589
+
590
+ - **Meaning:** writing one sheet's comments failed; the export goes on without them.
591
+ - **Likely cause:** SP-5801 or SP-5802 on that sheet, or an unexpected part.
592
+ - **Fix:** read the error logged after this line; the export report lists the skipped ids.
593
+
594
+ ---
595
+
596
+ ## 6xxx · column rules and the rules file
597
+
598
+ The rules engine (`packages/grid/src/pane/rules.ts`). A rules file never
599
+ throws: each problem is one `note` error, `author: 'host'`, with its `code`.
600
+
601
+ ### SP-6001
602
+
603
+ **Column rule pattern is not a regular expression** · error · [SR-GRID](../records/0105_GRID.md) decision 22a · `TypeError`
604
+
605
+ - **Meaning:** a `pattern` in the element's `columns` does not compile.
606
+ - **Likely cause:** an unbalanced bracket or bad escape.
607
+ - **Fix:** test the pattern with `new RegExp(…)`; escape `\` once more inside a JS string.
608
+
609
+ ### SP-6002
610
+
611
+ **Column-rules validate function failed** · error · [SR-GRID](../records/0105_GRID.md) decision 22c
612
+
613
+ - **Meaning:** the host's `validate(ctx, signal)` threw or rejected; that cell has no result.
614
+ - **Likely cause:** a bug in the host function, or a network call that failed.
615
+ - **Fix:** read the error logged after this line; return `null` rather than throw.
616
+
617
+ ### SP-6003
618
+
619
+ **Value refused by a rule** · warning · [SR-GRID](../records/0105_GRID.md) decision 22b
620
+
621
+ - **Meaning:** a rule with `onInvalid: 'block'` refused a typed value; it is never stored. `sheetpane-editcancel` fires with `reason: 'blocked'` and this code.
622
+ - **Likely cause:** the value breaks the rule — the event's `message` says how.
623
+ - **Fix:** type a value the rule accepts, or set `onInvalid: 'flag'` to keep it as an error instead.
624
+
625
+ ### SP-6010
626
+
627
+ **Rules file is not a JSON object** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
628
+
629
+ - **Meaning:** the rules document is not an object; no rule from it is checked.
630
+ - **Likely cause:** an array, a string, or a number given as `rules`.
631
+ - **Fix:** give `{ "version": 1, "sheets": { … } }`.
632
+
633
+ ### SP-6011
634
+
635
+ **Rules file could not be read** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
636
+
637
+ - **Meaning:** `rules-src` could not be fetched or parsed; no rule from it is checked.
638
+ - **Likely cause:** a 404, CORS, or JSON that does not parse.
639
+ - **Fix:** open the URL in the browser and validate it against `@sheetpane/grid/rules.schema.json`.
640
+
641
+ ### SP-6012
642
+
643
+ **Unknown rules file version** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
644
+
645
+ - **Meaning:** `version` is not one this grid reads (1); no rule from it is checked.
646
+ - **Likely cause:** a missing `version`, or a file for a newer grid.
647
+ - **Fix:** set `"version": 1`.
648
+
649
+ ### SP-6013
650
+
651
+ **Unknown key in the rules file** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
652
+
653
+ - **Meaning:** a top-level or sheet-level key is not one the file defines; it is ignored.
654
+ - **Likely cause:** a typo (`colums`), or a key for a newer grid.
655
+ - **Fix:** top level: `$schema`, `version`, `sheets`; per sheet: `headerRow`, `columns`, `cells`.
656
+
657
+ ### SP-6014
658
+
659
+ **Rules file has no sheets** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
660
+
661
+ - **Meaning:** the file has no `sheets` object; no rule is checked.
662
+ - **Likely cause:** rules written at the top level.
663
+ - **Fix:** put them under `"sheets": { "*": { "columns": { … } } }`.
664
+
665
+ ### SP-6015
666
+
667
+ **Rule is not an object** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
668
+
669
+ - **Meaning:** a column rule, a cell rule or a sheet's rules is not an object; it is skipped.
670
+ - **Likely cause:** `"Age": 18` instead of `"Age": { "min": 18 }`.
671
+ - **Fix:** write each rule as an object of rule words.
672
+
673
+ ### SP-6016
674
+
675
+ **Unknown rule word** · note · [SR-GRID](../records/0105_GRID.md) decision 22a
676
+
677
+ - **Meaning:** a rule names a word the vocabulary lacks; it is ignored.
678
+ - **Likely cause:** a typo (`requird`), or a word for a newer grid.
679
+ - **Fix:** use `required`, `type`, `min`, `max`, `minLength`, `maxLength`, `pattern`, `oneOf`, `noneOf`, `equals`, `unique`, `message`, `note`, `severity`, `onInvalid`.
680
+
681
+ ### SP-6017
682
+
683
+ **Unknown rule type** · note · [SR-GRID](../records/0105_GRID.md) decision 22a
684
+
685
+ - **Meaning:** `type` is not one the engine checks.
686
+ - **Likely cause:** `"type": "string"` or `"float"`.
687
+ - **Fix:** use `text`, `number`, `integer`, `date` or `boolean`.
688
+
689
+ ### SP-6018
690
+
691
+ **Rules file pattern is not a regular expression** · note · [SR-GRID](../records/0105_GRID.md) decision 22a
692
+
693
+ - **Meaning:** a `pattern` in the rules file does not compile; it is not tested.
694
+ - **Likely cause:** an unbalanced bracket, or a JSON escape eaten (`"\d"` must be `"\\d"`).
695
+ - **Fix:** escape backslashes twice in JSON.
696
+
697
+ ### SP-6019
698
+
699
+ **Rule list is not a list** · note · [SR-GRID](../records/0105_GRID.md) decision 22a
700
+
701
+ - **Meaning:** `oneOf` or `noneOf` is not an array.
702
+ - **Likely cause:** `"oneOf": "Active"`.
703
+ - **Fix:** `"oneOf": ["Active", "Inactive"]`.
704
+
705
+ ### SP-6020
706
+
707
+ **Header row is not a row number** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
708
+
709
+ - **Meaning:** a sheet's `headerRow` is not a number of 1 or more; the default applies.
710
+ - **Likely cause:** `"headerRow": "2"` or `0`.
711
+ - **Fix:** `"headerRow": 2` (1-based).
712
+
713
+ ### SP-6021
714
+
715
+ **Not a cell or a range** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
716
+
717
+ - **Meaning:** a key under `cells` is not an A1 cell or range; its rule is skipped.
718
+ - **Likely cause:** `"A"`, `"1:1"`, or a typo.
719
+ - **Fix:** use `"B2"` or `"B2:B200"`.
720
+
721
+ ### SP-6022
722
+
723
+ **Rules name a missing sheet** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
724
+
725
+ - **Meaning:** the rules file names a sheet the workbook lacks; its rules are not checked.
726
+ - **Likely cause:** a renamed sheet, or rules written for another workbook.
727
+ - **Fix:** match the sheet's exact name, or use `"*"` for every sheet.
728
+
729
+ ### SP-6023
730
+
731
+ **No column has this title** · note · [SR-GRID](../records/0105_GRID.md) decision 22a
732
+
733
+ - **Meaning:** a rule names a column title no sheet has in its header row; it is not checked.
734
+ - **Likely cause:** a renamed column, a different `header-row`, or a typo.
735
+ - **Fix:** match the title (trimmed, any case) or set `headerRow` / `header-row` to the row that holds it.
736
+
737
+ ### SP-6024
738
+
739
+ **Two columns share a title** · note · [SR-GRID](../records/0105_GRID.md) decision 22a
740
+
741
+ - **Meaning:** a ruled title appears twice in the header row; only the first column is checked.
742
+ - **Likely cause:** a duplicated column, or two blank-looking titles.
743
+ - **Fix:** rename one column, or accept that the first is the one checked.
744
+
745
+ ### SP-6025
746
+
747
+ **Rules file rule replaces the element’s** · note · [SR-GRID](../records/0105_GRID.md) decision 22d
748
+
749
+ - **Meaning:** the element's `columns` and the rules file both rule a title; the file's rule wins.
750
+ - **Likely cause:** rules kept in two places.
751
+ - **Fix:** keep the rule in one place.
752
+
753
+ ---
754
+
755
+ ## 7xxx · mcp
756
+
757
+ ### SP-7001
758
+
759
+ **Tool input is missing or malformed** · error · [SR-MCP](../records/0119_MCP.md) decision 7
760
+
761
+ - **Meaning:** a tool was called without an argument it needs, or with one of the wrong kind.
762
+ - **Likely cause:** the agent left out `path`, `rules`, `code` or `task`, passed an empty string, or a task with no searchable words.
763
+ - **Fix:** call the tool again with the argument its input schema names (`tools/list` shows it).
764
+
765
+ ### SP-7002
766
+
767
+ **No file at that path** · error · [SR-MCP](../records/0119_MCP.md) decision 7
768
+
769
+ - **Meaning:** the path given to `inspect_workbook`, `draft_rules` or `check_rules` names nothing.
770
+ - **Likely cause:** a typo, or a path relative to a different folder — relative paths are read from where the server runs.
771
+ - **Fix:** pass an absolute path, or one relative to the server's working directory.
772
+
773
+ ### SP-7003
774
+
775
+ **File too large for the tool** · error · [SR-MCP](../records/0119_MCP.md) decision 7
776
+
777
+ - **Meaning:** the file is over the 256 MB the server reads.
778
+ - **Likely cause:** a very large export.
779
+ - **Fix:** inspect a smaller extract, or read it with `@sheetpane/import` in your own script.
780
+
781
+ ### SP-7004
782
+
783
+ **Workbook could not be read** · error · [SR-MCP](../records/0119_MCP.md) decision 7
784
+
785
+ - **Meaning:** the import package failed on the file without one of its own SP-10xx codes.
786
+ - **Likely cause:** an internal failure while reading.
787
+ - **Fix:** report it with the file if you can share it; the reader's own refusals (SP-1001…SP-1007) are passed through with their codes.
788
+
789
+ ### SP-7005
790
+
791
+ **No sheet by that name** · error · [SR-MCP](../records/0119_MCP.md) decision 7
792
+
793
+ - **Meaning:** `draft_rules` was asked for a sheet the workbook does not have.
794
+ - **Likely cause:** a misspelt or renamed sheet; names are matched exactly.
795
+ - **Fix:** use a name from the list in the message, or leave `sheet` out for every sheet.
796
+
797
+ ### SP-7006
798
+
799
+ **Not a sheetpane code** · error · [SR-MCP](../records/0119_MCP.md) decision 7
800
+
801
+ - **Meaning:** `explain_code` was given something that is not in the registry.
802
+ - **Likely cause:** a typo, or a code from another library.
803
+ - **Fix:** codes look like `SP-1002`; the message lists nearby codes when there are any.
804
+
805
+ ### SP-7007
806
+
807
+ **Server data file missing** · error · [SR-MCP](../records/0119_MCP.md) decision 7
808
+
809
+ - **Meaning:** the server could not find `ERRORS.md` beside it.
810
+ - **Likely cause:** an incomplete install, or a build run without its copy step.
811
+ - **Fix:** reinstall `@sheetpane/mcp`; from the repository, run `pnpm --filter @sheetpane/mcp build`.