{"record":{"id":"5cb175d9eaf60e58","repo":"GoogleChrome/lighthouse","slug":"syntax-not-understood","errorCode":null,"errorMessage":"Syntax not understood","messagePattern":"Syntax not understood","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"core/audits/seo/robots-txt.js","lineNumber":126,"sourceCode":" * @return {{directive: string, value: string}|null}\n */\nfunction parseLine(line) {\n  const hashIndex = line.indexOf('#');\n\n  if (hashIndex !== -1) {\n    line = line.substr(0, hashIndex);\n  }\n\n  line = line.trim();\n\n  if (line.length === 0) {\n    return null;\n  }\n\n  const colonIndex = line.indexOf(':');\n\n  if (colonIndex === -1) {\n    throw new Error('Syntax not understood');\n  }\n\n  const directiveName = line.slice(0, colonIndex).trim().toLowerCase();\n  const directiveValue = line.slice(colonIndex + 1).trim();\n\n  verifyDirective(directiveName, directiveValue);\n\n  return {\n    directive: directiveName,\n    value: directiveValue,\n  };\n}\n\n/**\n * @param {string} content\n * @return {Array<{index: string, line: string, message: string}>}\n */\nfunction validateRobots(content) {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/core/audits/seo/robots-txt.js#L108-L144","documentation":"Thrown by parseLine() when a non-empty, non-comment line in robots.txt contains no colon (':') character. Every valid robots.txt directive uses the form 'Directive: value', so a line without a colon cannot be parsed into a directive/value pair. The error indicates genuinely unparseable syntax.","triggerScenarios":"A robots.txt line like 'BlockEverything' (no directive syntax), 'Some free text note', or a line with only spaces/words but no colon. Also triggered by malformed lines where the colon was accidentally replaced or deleted.","commonSituations":"Adding human-readable notes or labels in robots.txt without using '#' comment syntax. Corrupted file from a deploy or encoding issue. Pasting documentation text directly into the file. A misconfigured server-side template that strips or replaces colons.","solutions":["Prefix the line with '#' to make it a comment, e.g. '# This section blocks private pages'","Rewrite the line in valid directive syntax, e.g. 'Disallow: /path'","Remove the line if it was not meant to be a directive"],"exampleFix":"// before\nThis blocks the admin section\n\n// after\n# This blocks the admin section\nDisallow: /admin","handlingStrategy":"validation","validationCode":"// Validate that every non-comment, non-empty line has a colon\nfunction validateLineSyntax(content) {\n  const lines = content.split(/\\r\\n|\\r|\\n/);\n  const errors = [];\n  lines.forEach((line, idx) => {\n    const noComment = line.split('#')[0].trim();\n    if (noComment.length > 0 && !noComment.includes(':')) {\n      errors.push(`Line ${idx + 1}: No colon found — syntax not understood`);\n    }\n  });\n  return errors;\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseLine(line);\n} catch (e) {\n  // e.message === 'Syntax not understood'\n  robotsErrors.push({ line, message: e.message });\n}","preventionTips":["Use '#' for comments instead of bare text lines","Ensure every directive follows 'Directive: value' format","Run a robots.txt syntax checker in CI or pre-deploy"],"tags":["robots-txt","seo","validation","parsing"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}