{"record":{"id":"ef416bd7e1300bc5","repo":"denoland/deno","slug":"empty-node","errorCode":null,"errorMessage":"Empty node","messagePattern":"Empty node","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/js/40_lint_selector.js","lineNumber":778,"sourceCode":"/**\n * @param {Selector[]} result\n * @param {Selector[]} stack\n */\nfunction popSelector(result, stack) {\n  const sel = /** @type {Selector} */ (stack.pop());\n\n  if (stack.length === 0) {\n    result.push(sel);\n    stack.push([]);\n  } else {\n    const prev = /** @type {Selector} */ (stack.at(-1));\n    if (prev.length === 0) {\n      throw new Error(`Empty selector`);\n    }\n\n    const node = prev.at(-1);\n    if (node === undefined) {\n      throw new Error(`Empty node`);\n    }\n\n    if (node.type === PSEUDO_NTH_CHILD) {\n      node.of = sel;\n    } else if (\n      node.type === PSEUDO_HAS || node.type === PSEUDO_IS ||\n      node.type === PSEUDO_NOT\n    ) {\n      node.selectors.push(sel);\n    } else {\n      throw new Error(`Multiple selectors not allowed here`);\n    }\n  }\n}\n\nconst TRUE_FN = () => {\n  return true;\n};","sourceCodeStart":760,"sourceCodeEnd":796,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_lint_selector.js#L760-L796","documentation":"`Empty node` is a defensive invariant check in popSelector (cli/js/40_lint_selector.js): after confirming the parent selector group is non-empty, it reads the group's last node and throws if it is undefined. Logically the preceding length check makes this unreachable — a non-empty array always has a last element — so seeing it means internal parser state was corrupted by a malformed selector key, not anything actionable in your own code.","triggerScenarios":"Effectively unreachable through normal selector syntax; it guards against an inconsistent parser state after a malformed or degenerate visitor key was partially parsed.","commonSituations":"Almost always a latent parser edge case rather than a user mistake; if reproducible, the value is a bug report against the selector engine.","solutions":["Minimize the visitor key that triggers it and simplify the selector (drop pseudo-clauses and attribute parts one by one).","Move complex matching logic out of the selector and into JavaScript inside the visitor callback.","Report the minimal reproducible key to the Deno repository, since this guard should not be reachable."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat this error as a parser-bug signal, not a fixable input error.","Reproduce with the smallest visitor key possible and report it upstream with the exact selector string."],"tags":["deno","deno-lint","lint-plugin","selector","parse-error","invariant"],"backgroundTag":"invalid-selector-syntax","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}