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
- Pass a non-empty name string identifying the deployer.
- Validate the name source (config/package) before registering.
- 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
- Derive deployer names from a constant, not loose config.
- Validate in a shared registerDeployer helper.
- Test that the deployer name appears in hexo.extend.deployer.list().
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.