larksuite/cli · error
unsupported type %q
Error message
unsupported type %q
What it means
buildTypedCell only supports the declared column dtypes the table-put machinery knows (e.g. string, number, bool, date, object). An unrecognized col.Type string hits the default case and throws this error before any rows are processed; callers wrap it with typed validation context.
Source
Thrown at shortcuts/sheets/lark_sheet_table_io.go:712
cell["value"] = n
case "bool":
b, ok := raw.(bool)
if !ok {
return nil, fmt.Errorf("bool expects true/false, got %s", describeJSONType(raw)) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context
}
cell["value"] = b
case "date":
str, ok := raw.(string)
if !ok {
return nil, fmt.Errorf("date expects an ISO yyyy-mm-dd string, got %s", describeJSONType(raw)) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context
}
serial, err := isoDateToSerial(str)
if err != nil {
return nil, err
}
cell["value"] = serial
default:
return nil, fmt.Errorf("unsupported type %q", col.Type) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context
}
return cell, nil
}
// stringifyCellValue renders any JSON scalar as the literal text a string
// column should hold. json.Number keeps its exact digits (no scientific
// notation), so IDs / postcodes survive as written.
func stringifyCellValue(raw interface{}) string {
switch v := raw.(type) {
case string:
return v
case json.Number:
return v.String()
case bool:
if v {
return "TRUE"
}
return "FALSE"View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Run the schema/help (lark sheet table-put --print-schema or --help) to list supported dtypes and use one exactly
- Fix the type spelling/case in the --sheets payload
- Use "object" (text) as the safe catch-all dtype for unsupported value kinds
Example fix
// before
{"name":"Age","type":"integer"}
// after
{"name":"Age","type":"number"} Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_DTYPES = new Set(['string','number','bool','date','object']); // confirm via --print-schema
function assertDtypes(cols) {
cols.forEach(c => { if (!SUPPORTED_DTYPES.has(c.type)) throw new Error(`unsupported dtype '${c.type}' for column ${c.name}`); });
} Type guard
function hasSupportedDtype(col, supported) { return supported.includes(col.type); } Try / catch
try {
await run(['lark','sheet','table-put','--sheets',payload]);
} catch (e) {
if (/unsupported type /.test(e.message)) {
// fix col.Type to a supported dtype (see --print-schema) and retry
}
throw e;
} Prevention
- Check supported dtype names with table-put --help or --print-schema before authoring payloads
- Never invent dtypes ("integer", "datetime"); map them to the CLI's vocabulary
- Copy dtype names exactly (case-sensitive) from the schema
When it happens
Trigger: Typo in a column type, e.g. {"type":"integer"} or {"type":"datetime"} or {"type":"Number"} instead of a supported dtype.
Common situations: Guessing dtype names from generic spreadsheet vocabulary ("integer", "float", "timestamp") instead of the CLI's schema; case-sensitivity slips after editing JSON by hand.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- number expects a numeric value, got %s
- bool expects true/false, got %s
- expected pure digits (row number) or letters (column letter)
- date expects an ISO yyyy-mm-dd string, got %s
- date column has an empty cell — drop the empty rows, fill re
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/3ea9298547ca9a9d.
Report an issue: GitHub.