hexojs/hexo · error · TypeError

name is required

Error message

name is required

What it means

Thrown by Deployer.register when the 'name' argument is falsy. Hexo deployers are identified by a name (e.g. 'git', 'rsync') used in the deploy config; a falsy name would make the deployment unselectable, so registration is rejected.

Source

Thrown at lib/extend/deployer.ts:41

    return this.store;
  }

  get(name: string): StoreFunction {
    return this.store[name];
  }

  register(
    name: string,
    fn: (
      this: Hexo,
      deployArg: {
        type: string;
        [key: string]: any;
      },
      callback?: NodeJSLikeCallback<any>
    ) => any
  ): void {
    if (!name) throw new TypeError('name is required');
    if (typeof fn !== 'function') throw new TypeError('fn must be a function');

    if (fn.length > 1) {
      fn = Promise.promisify(fn);
    } else {
      fn = Promise.method(fn);
    }

    this.store[name] = fn;
  }
}

export = Deployer;

View on GitHub (pinned to 059cb17494)

Solutions

  1. Pass a non-empty name string identifying the deployer.
  2. Validate the name source (config/package) before registering.
  3. Ensure dynamic registration does not pass undefined.

Example fix

// before
hexo.extend.deployer.register(deployerName, fn);
// after
if (deployerName) hexo.extend.deployer.register(deployerName, fn);
Defensive patterns

Strategy: validation

Validate before calling

if (!name) throw new Error('deployer name required');
hexo.extend.deployer.register(name, fn);

Type guard

const isValidName = (n: unknown): n is string => typeof n === 'string' && n.length > 0;

Prevention

When it happens

Trigger: Calling hexo.extend.deployer.register('', fn) or register(undefined, fn).

Common situations: A deployer plugin derives its name from package.json name field that is empty, or a dynamic registration loop produced an empty name.

Related errors


AI-assisted analysis of hexojs/hexo@059cb17494 (2026-08-12). Data as JSON: /api/errors/9b93fb94fbe4dfca. Report an issue: GitHub.