{"record":{"id":"07057f1126dca39f","repo":"larksuite/cli","slug":"bool-expects-true-false-got-s","errorCode":null,"errorMessage":"bool expects true/false, got %s","messagePattern":"bool expects true/false, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/lark_sheet_table_io.go","lineNumber":698,"sourceCode":"\tswitch col.Type {\n\tcase \"\":\n\t\t// Type-less column: write the raw JSON scalar as-is so Lark Sheets\n\t\t// auto-detects the type (numeric → number, else text). json.Number is\n\t\t// kept verbatim for precision; an optional --styles number_format\n\t\t// controls display. This is the untyped --values behavior.\n\t\tcell[\"value\"] = raw\n\tcase \"string\":\n\t\tcell[\"value\"] = stringifyCellValue(raw)\n\tcase \"number\":\n\t\tn, ok := raw.(json.Number)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"number expects a numeric value, got %s\", describeJSONType(raw)) //nolint:forbidigo // intermediate error; callers wrap it into a typed --sheets/--values validation error with row/column context\n\t\t}\n\t\tcell[\"value\"] = n\n\tcase \"bool\":\n\t\tb, ok := raw.(bool)\n\t\tif !ok {\n\t\t\treturn 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\n\t\t}\n\t\tcell[\"value\"] = b\n\tcase \"date\":\n\t\tstr, ok := raw.(string)\n\t\tif !ok {\n\t\t\treturn 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\n\t\t}\n\t\tserial, err := isoDateToSerial(str)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcell[\"value\"] = serial\n\tdefault:\n\t\treturn 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\n\t}\n\treturn cell, nil\n}\n","sourceCodeStart":680,"sourceCodeEnd":716,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_table_io.go#L680-L716","documentation":"buildTypedCell requires a column declared \"bool\" to carry JSON true/false. Any other JSON value (string \"true\", number, null) fails this check; the caller adds row/column context and wraps it in a typed validation error.","triggerScenarios":"Bool column given \"true\"/\"false\" as JSON strings (common when data passed through shells or CSV converters); null for empty cells.","commonSituations":"Quoting booleans because the payload was built by string templating; environment configs serializing bools as strings; null holes in data grids.","solutions":["Use unquoted JSON true/false literals","Change the column dtype to \"string\" if \"true\"/\"false\" text is intentional","Fill empty cells with explicit booleans or drop those rows"],"exampleFix":"// before\n{\"name\":\"Active\",\"type\":\"bool\",\"data\":[\"true\"]}\n// after\n{\"name\":\"Active\",\"type\":\"bool\",\"data\":[true]}","handlingStrategy":"validation","validationCode":"function assertBoolColumn(col) {\n  col.data.forEach((v, i) => {\n    if (typeof v !== 'boolean') throw new Error(`column ${col.name} (bool): row ${i} value ${JSON.stringify(v)} is not true/false`);\n  });\n}","typeGuard":"function isJSONBool(v) { return typeof v === 'boolean'; }","tryCatchPattern":"try {\n  await run(['lark','sheet','table-put','--sheets',payload]);\n} catch (e) {\n  if (/bool expects true\\/false/.test(e.message)) {\n    payload = payload.replace(/\"(true|false)\"/g, '$1'); // unquote booleans\n  }\n  throw e;\n}","preventionTips":["Emit bare true/false literals, never \"true\"/\"false\" strings","Avoid building JSON by string templating; use JSON.stringify of real values","Use dtype \"string\" if boolean-ish text is intentional"],"tags":["cli","json","validation","sheets","dtype"],"backgroundTag":"schema-validation-failed","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}