{"record":{"id":"da957d023d61123f","repo":"facebook/react","slug":"162-da957d","errorCode":"162","errorMessage":"This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.","messagePattern":"This should have a text node initialized\\. This error is likely caused by a bug in React\\. Please file an issue\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-reconciler/src/ReactFiberCommitWork.js","lineNumber":2353,"sourceCode":"            // memory, point `alternate.stateNode` to new shadow node. This\n            // prevents shadow node from staying in memory longer than it\n            // needs to. The correct behaviour of this is checked by test in\n            // React Native: ShadowNodeReferenceCounter-itest.js#L150\n            finishedWork.alternate.stateNode = finishedWork.stateNode;\n          }\n        }\n      }\n      break;\n    }\n    case HostText: {\n      recursivelyTraverseMutationEffects(root, finishedWork, lanes);\n      commitReconciliationEffects(finishedWork, lanes);\n\n      if (flags & Update) {\n        // $FlowFixMe[constant-condition]\n        if (supportsMutation) {\n          if (finishedWork.stateNode === null) {\n            throw new Error(\n              'This should have a text node initialized. This error is likely ' +\n                'caused by a bug in React. Please file an issue.',\n            );\n          }\n\n          const newText: string = finishedWork.memoizedProps;\n          // For hydration we reuse the update path but we treat the oldProps\n          // as the newProps. The updatePayload will contain the real change in\n          // this case.\n          const oldText: string =\n            current !== null ? current.memoizedProps : newText;\n\n          commitHostTextUpdate(finishedWork, newText, oldText);\n        }\n      }\n      break;\n    }\n    case HostRoot: {","sourceCodeStart":2335,"sourceCodeEnd":2371,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-reconciler/src/ReactFiberCommitWork.js#L2335-L2371","documentation":"commitMutationEffectsOnFiber() applies a text update by calling the host's text-update path on the fiber's stateNode. A HostText fiber gets its instance in completeWork via createTextInstance; the Update flag with a null stateNode means the instance was never created or was lost - either an internal abort/reuse bug or, for custom renderers, a host config that returns null from createTextInstance.","triggerScenarios":"A custom renderer (react-reconciler host config) whose createTextInstance returns null or undefined; hydration where the text node was never adopted; React bugs where an interrupted render reused a HostText fiber without an instance and flagged it for update.","commonSituations":"Building or using custom renderers (canvas, PDF, 3D) that have no real text nodes and stub createTextInstance; text inside trees that suspend mid-commit; crashes reported after aborting concurrent renders.","solutions":["Renderer maintainers: make createTextInstance return a stable non-null opaque instance (a {text} object is fine)","If using a third-party renderer, update it - non-null instances are part of the renderer contract","On react-dom: update React and check whether the text sits inside a Suspense/Activity boundary suspending during the update","File an issue naming the renderer and a minimal tree"],"exampleFix":"// before - custom renderer host config\ncreateTextInstance: (text) => null,\n\n// after - return an opaque non-null instance\ncreateTextInstance: (text) => ({text}),\ncommitTextUpdate: (inst, newText) => { inst.text = newText; },","handlingStrategy":"validation","validationCode":"// Custom-renderer smoke test: text creation must yield an instance\nconst inst = hostConfig.createTextInstance('probe', container, null, {});\nif (inst == null) {\n  throw new Error('hostConfig.createTextInstance must return a non-null instance');\n}","typeGuard":null,"tryCatchPattern":"If you cannot fix the host config, catch via onUncaughtError and re-render the subtree without text children as a degraded fallback.","preventionTips":["Treat createTextInstance and createInstance return values as never-null in renderer contracts","Test custom renderers with trees containing plain string children","Update react-reconciler-based renderers in lockstep with react"],"tags":["host-text","custom-renderer","commit-phase","hydration"],"backgroundTag":"text-instance-not-initialized","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}