{"record":{"id":"b8ef7fdd81fdbc9c","repo":"tailwindlabs/tailwindcss","slug":"unterminated-string-input-slice-startidx-i","errorCode":null,"errorMessage":"Unterminated string: ${input.slice(startIdx, i) + String.fromCharCode(quoteChar)}","messagePattern":"Unterminated string: (.+?)","errorType":"exception","errorClass":"CssSyntaxError","httpStatus":null,"severity":"error","filePath":"packages/tailwindcss/src/css-parser.ts","lineNumber":709,"sourceCode":"        source ? [source, startIdx, i + 1] : null,\n      )\n    }\n\n    // End of the line without ending the string.\n    //\n    // E.g.:\n    //\n    // ```css\n    // .foo {\n    //   content: \"This is a string with a\n    //                                    ^ Missing \"\n    // }\n    // ```\n    else if (\n      peekChar === LINE_BREAK ||\n      (peekChar === CARRIAGE_RETURN && input.charCodeAt(i + 1) === LINE_BREAK)\n    ) {\n      throw new CssSyntaxError(\n        `Unterminated string: ${input.slice(startIdx, i) + String.fromCharCode(quoteChar)}`,\n        source ? [source, startIdx, i + 1] : null,\n      )\n    }\n  }\n\n  return startIdx\n}\n","sourceCodeStart":691,"sourceCodeEnd":718,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/packages/tailwindcss/src/css-parser.ts#L691-L718","documentation":"Thrown by the string scanner when an unescaped newline (LF, or CR+LF) appears inside a quoted string before the closing quote. CSS does not allow raw line breaks inside quoted strings, so the scanner treats a newline as an unterminated string and reports it. The message reconstructs the partial string up to (but not including) the newline and appends the expected quote character.","triggerScenarios":"Writing `.x { content: \"hello\\nworld\" }` with an actual line break in the source (rather than an escaped `\\A` or `\\n`); a quoted string that wraps in the editor without a backslash continuation.","commonSituations":"Pressing Enter inside a `content:` string; multi-line font-family names; copy-paste of multi-line text into a CSS string.","solutions":["Keep the string on one line, or escape the line break with `\\A` (for content) / a backslash-newline continuation.","Close the quote before the line break and reopen it on the next line if concatenation is intended.","For dynamic content use a CSS variable set from JS instead of an inline multi-line string."],"exampleFix":"/* before */\n.x { content: \"hello\nworld\"; }\n/* after */\n.x { content: \"hello world\"; }","handlingStrategy":"validation","validationCode":"// Detect raw newlines inside quoted strings\nfunction findNewlinesInStrings(css: string): string[] {\n  const bad: string[] = [];\n  const re = /([\"'])((?:\\\\.|(?!\\1).)*?)(\\n)/gs;\n  let m;\n  while ((m = re.exec(css))) {\n    if (!m[2].endsWith('\\\\')) bad.push(m[0]);\n  }\n  return bad;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const ast = CSS.parse(input);\n} catch (e) {\n  if (e instanceof CssSyntaxError && e.message.startsWith('Unterminated string')) {\n    // the message pinpoints the line; close the quote\n  } else throw e;\n}","preventionTips":["Never paste raw multi-line text into a CSS string.","Escape line breaks with \\A for content, or keep strings on one line.","Lint CSS for newlines inside quotes."],"tags":["tailwind-v4","css-parser","string","unterminated","newline","syntax-error"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}