{"record":{"id":"989efec00788b073","repo":"codex-team/editor.js","slug":"element-with-id-holder-is-missing-pass-corre","errorCode":null,"errorMessage":"element with ID «${holder}» is missing. Pass correct holder's ID.","messagePattern":"element with ID «(.+?)» is missing\\. Pass correct holder's ID\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/components/core.ts","lineNumber":214,"sourceCode":"  public get configuration(): EditorConfig {\n    return this.config;\n  }\n\n  /**\n   * Checks for required fields in Editor's config\n   */\n  public validate(): void {\n    const { holderId, holder } = this.config;\n\n    if (holderId && holder) {\n      throw Error('«holderId» and «holder» param can\\'t assign at the same time.');\n    }\n\n    /**\n     * Check for a holder element's existence\n     */\n    if (_.isString(holder) && !$.get(holder)) {\n      throw Error(`element with ID «${holder}» is missing. Pass correct holder's ID.`);\n    }\n\n    if (holder && _.isObject(holder) && !$.isElement(holder)) {\n      throw Error('«holder» value must be an Element node');\n    }\n  }\n\n  /**\n   * Initializes modules:\n   *  - make and save instances\n   *  - configure\n   */\n  public init(): void {\n    /**\n     * Make modules instances and save it to the @property this.moduleInstances\n     */\n    this.constructModules();\n","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/codex-team/editor.js/blob/5f45dabbe5690b7033b2f9047d3985add5045fdd/src/components/core.ts#L196-L232","documentation":"When `holder` is a string it is treated as an element ID and looked up in the DOM; if document.getElementById finds nothing, the constructor throws with the given ID, since the editor has nowhere to render.","triggerScenarios":"new EditorJS({ holder: 'editorjs' }) when no element with id=\"editorjs\" exists yet — typically because the script runs before the DOM is ready or the ID is misspelled.","commonSituations":"Script loaded in <head> without defer or before the element; SSR/hydration timing where the mount node isn't present; typo'd or dynamically-generated IDs that don't match.","solutions":["Move initialization after DOM ready (DOMContentLoaded) or to the end of body / use defer","Verify the ID matches: document.getElementById('editorjs') before constructing","Pass the element itself (holder: el) when you already have a reference"],"exampleFix":"// before\nnew EditorJS({ holder: 'editorjs', tools });\n// after\ndocument.addEventListener('DOMContentLoaded', () => {\n  new EditorJS({ holder: 'editorjs', tools });\n});","handlingStrategy":"validation","validationCode":"const el = document.getElementById(holderId); if (!el) throw new Error('mount node missing'); new EditorJS({ holder: el });","typeGuard":"const getHolderEl = (h: string): HTMLElement | null => document.getElementById(h);","tryCatchPattern":"try { new EditorJS({ holder: 'editorjs' }); } catch (e) { if (e instanceof Error && e.message.includes(\"is missing\")) { document.addEventListener('DOMContentLoaded', () => new EditorJS({ holder: 'editorjs' })); return; } throw e; }","preventionTips":["Init on DOMContentLoaded or with defer","Pass the resolved element instead of an ID string"],"tags":["config","holder","dom-not-ready","editorjs"],"backgroundTag":"element-not-found","analyzedSha":"5f45dabbe5690b7033b2f9047d3985add5045fdd","analyzedAt":"2026-08-27T22:50:23.124Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}