{"record":{"id":"44434e7e3531d787","repo":"toon-format/toon","slug":"blank-lines-inside-context-are-not-allowed-in-s","errorCode":null,"errorMessage":"Blank lines inside ${context} are not allowed in strict mode","messagePattern":"Blank lines inside (.+?) are not allowed in strict mode","errorType":"exception","errorClass":"ToonDecodeError","httpStatus":null,"severity":"error","filePath":"packages/toon/src/decode/validation.ts","lineNumber":68,"sourceCode":"  }\n}\n\nexport function validateNoBlankLinesInRange(\n  startLine: number,\n  endLine: number,\n  blankLines: BlankLineInfo[],\n  strict: boolean,\n  context: string,\n): void {\n  if (!strict)\n    return\n\n  const firstBlank = blankLines.find(\n    blank => blank.lineNumber > startLine && blank.lineNumber < endLine,\n  )\n\n  if (firstBlank) {\n    throw new ToonDecodeError(\n      `Blank lines inside ${context} are not allowed in strict mode`,\n      { line: firstBlank.lineNumber },\n    )\n  }\n}\n\n// #endregion\n\n// #region Row classification helpers\n\n/** Checks if a line is a data row (vs a key-value pair) in a tabular array. */\nexport function isDataRow(content: string, delimiter: Delimiter): boolean {\n  const colonPos = findUnquotedChar(content, COLON)\n  const delimiterPos = findUnquotedChar(content, delimiter)\n\n  if (colonPos === -1) {\n    return true\n  }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/toon-format/toon/blob/604eac266e35166bed6f5b9e3bd586e9c60a9330/packages/toon/src/decode/validation.ts#L50-L86","documentation":"Thrown by validateNoBlankLinesInRange when strict-mode decoding finds a blank line strictly between the start and end of a keyed object, tabular array, or list array block. TOON treats blank lines inside multi-line structures as structurally ambiguous in strict mode, since they could merge or split blocks. The error reports the first offending blank line. Only fires when strict is true; the function returns early otherwise.","triggerScenarios":"Decoding TOON input with strict:true containing an empty line inside a keyed object, tabular array body, or list-form array body (decodeKeyedObject / decodeTabularArray / decodeListArray).","commonSituations":"Humans hand-editing TOON for readability and inserting separator blank lines; templating tools or editors that add trailing blank lines between blocks; concatenating chunks that each end with a newline.","solutions":["Remove the blank line(s) inside the array/object block","Decode with { strict: false } if blank-line tolerance is acceptable","Run a preprocessor that strips blank lines within indentation blocks before decoding"],"exampleFix":"// before\nitems[2]:\n  - a\n\n  - b\n// after\nitems[2]:\n  - a\n  - b","handlingStrategy":"validation","validationCode":"const clean = input.split('\\n').filter((l, i, a) => !(l.trim() === '' && insideBlock(a, i))).join('\\n')","typeGuard":null,"tryCatchPattern":"try { decode(input, { strict: true }) } catch (e) { if (e instanceof ToonDecodeError && e.message.includes('Blank lines inside')) console.error('blank line at line', e.line?.lineNumber, '— strip blank lines inside blocks') }","preventionTips":["Never insert blank lines inside array/object blocks in TOON files","Configure editors/formatters not to inject blank lines in .toon files","Strip blank lines programmatically when accepting human-edited TOON","Or decode with strict:false if blank-line tolerance is desired"],"tags":["toon","strict-mode","decode","formatting"],"backgroundTag":"blank-line-in-block","analyzedSha":"604eac266e35166bed6f5b9e3bd586e9c60a9330","analyzedAt":"2026-08-31T11:09:25.043Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}