{"record":{"id":"a3559546f427e0b0","repo":"emotion-js/emotion","slug":"unexpected-null-when-attempting-to-fix-context-g","errorCode":null,"errorMessage":"Unexpected null when attempting to fix ${context.getFilename()} - please file a github issue at ${REPO_URL}","messagePattern":"Unexpected null when attempting to fix (.+?) - please file a github issue at (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/eslint-plugin/src/rules/jsx-import.ts","lineNumber":115,"sourceCode":"              node,\n              messageId: 'cssProp',\n              data: { importSource },\n              fix(fixer) {\n                return fixer.insertTextBefore(\n                  sourceCode.ast.body[0],\n                  `/** @jsxImportSource ${importSource} */\\n`\n                )\n              }\n            })\n          } else if (!validJsxImportSource && jsxImportSourcePragmaComment) {\n            context.report({\n              node,\n              messageId: 'cssProp',\n              data: { importSource },\n              fix(fixer) {\n                /* istanbul ignore if */\n                if (jsxImportSourcePragmaComment === null) {\n                  throw new Error(\n                    `Unexpected null when attempting to fix ${context.getFilename()} - please file a github issue at ${REPO_URL}`\n                  )\n                }\n\n                return fixer.replaceText(\n                  jsxImportSourcePragmaComment,\n                  `/** @jsxImportSource ${importSource} */`\n                )\n              }\n            })\n          }\n        }\n      }\n    }\n\n    return {\n      JSXAttribute(node) {\n        if (node.name.name !== 'css') {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/emotion-js/emotion/blob/b882bcba85132554992e4bd49e94c95939bbf810/packages/eslint-plugin/src/rules/jsx-import.ts#L97-L133","documentation":"The jsx-import ESLint rule's autofixer replaces the @jsxImportSource pragma comment; it asserts the comment node it located earlier is non-null when the fix runs. If it's null at fix time (an internal invariant violation), it throws and asks the user to file a GitHub issue.","triggerScenarios":"Running eslint --fix on JSX code where the rule reported 'cssProp' but the previously captured jsxImportSourcePragmaComment reference became null when the fixer executed.","commonSituations":"A plugin/rule bug rather than user error — potentially triggered by unusual comment positioning or interactions with other fixing rules between suggestion and fix phases.","solutions":["File a GitHub issue at the emotion repo with the file and ESLint config reproducing it","Temporarily disable the jsx-import rule (or run without --fix) for that file","Update @emotion/eslint-plugin to the latest version in case the bug is fixed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// no pre-call validation possible; this is an internal invariant of the rule's fixer","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep @emotion/eslint-plugin and eslint versions compatible and current","If it reproduces, minimize the file and report it to the emotion repo","Run lint without --fix in CI to surface issues before autofix runs"],"tags":["eslint","autofix","emotion"],"backgroundTag":"autofix-invariant-violation","analyzedSha":"b882bcba85132554992e4bd49e94c95939bbf810","analyzedAt":"2026-09-02T22:27:13.739Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}