codex-team/editor.js · critical · Error

«holderId» and «holder» param can't assign at the same time.

Error message

«holderId» and «holder» param can't assign at the same time.

What it means

Editor's config validation rejects specifying both `holderId` and `holder`; they are alternative ways to point at the mounting element, and passing both is ambiguous, so the constructor throws immediately.

Source

Thrown at src/components/core.ts:207

  }

  /**
   * Returns private property
   *
   * @returns {EditorConfig}
   */
  public get configuration(): EditorConfig {
    return this.config;
  }

  /**
   * Checks for required fields in Editor's config
   */
  public validate(): void {
    const { holderId, holder } = this.config;

    if (holderId && holder) {
      throw Error('«holderId» and «holder» param can\'t assign at the same time.');
    }

    /**
     * Check for a holder element's existence
     */
    if (_.isString(holder) && !$.get(holder)) {
      throw Error(`element with ID «${holder}» is missing. Pass correct holder's ID.`);
    }

    if (holder && _.isObject(holder) && !$.isElement(holder)) {
      throw Error('«holder» value must be an Element node');
    }
  }

  /**
   * Initializes modules:
   *  - make and save instances
   *  - configure

View on GitHub (pinned to 5f45dabbe5)

Solutions

  1. Remove one of the two keys — prefer the modern `holder`
  2. Sanitize merged config: delete holderId when holder is set
  3. Centralize editor config construction so both keys can't be supplied

Example fix

// before
new EditorJS({ holderId: 'editorjs', holder: 'editorjs', tools });
// after
new EditorJS({ holder: 'editorjs', tools });
Defensive patterns

Strategy: validation

Validate before calling

if (cfg.holderId && cfg.holder) delete cfg.holderId; new EditorJS(cfg);

Type guard

const hasSingleHolder = (c: { holder?: unknown; holderId?: unknown }): boolean => !(c.holder && c.holderId);

Try / catch

try { new EditorJS(cfg); } catch (e) { if (e instanceof Error && e.message.includes('at the same time')) { delete cfg.holderId; new EditorJS(cfg); return; } throw e; }

Prevention

When it happens

Trigger: Creating an editor with { holderId: 'editorjs', holder: 'editorjs', ... } or merging configs where both keys survive (spread/defaults combination).

Common situations: Config built by Object.assign/spread of a base config plus overrides; migrating old holderId code while adding holder; copy-pasted examples combining both parameters.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of codex-team/editor.js@5f45dabbe5 (2026-08-27). Data as JSON: /api/errors/08606f1d829d41e1. Report an issue: GitHub.