{"record":{"id":"b80121d74149da6e","repo":"hexojs/hexo","slug":"name-is-required-b80121","errorCode":null,"errorMessage":"name is required","messagePattern":"name is required","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/extend/helper.ts","lineNumber":79,"sourceCode":"    return this.store;\n  }\n\n  /**\n   * Get helper plugin function by name\n   * @param {String} name - The name of the helper plugin\n   * @returns {StoreFunction}\n   */\n  get(name: string): StoreFunction {\n    return this.store[name];\n  }\n\n  /**\n   * Register a helper plugin\n   * @param {String} name - The name of the helper plugin\n   * @param {StoreFunction} fn - The helper plugin function\n   */\n  register(name: string, fn: StoreFunction): void {\n    if (!name) throw new TypeError('name is required');\n    if (typeof fn !== 'function') throw new TypeError('fn must be a function');\n\n    this.store[name] = fn;\n  }\n}\n\nexport = Helper;\n","sourceCodeStart":61,"sourceCodeEnd":87,"githubUrl":"https://github.com/hexojs/hexo/blob/059cb17494d0632a053c24077f5bcb6ae92acc51/lib/extend/helper.ts#L61-L87","documentation":"Thrown by Helper.register when the 'name' argument is falsy. Helpers are template-callable functions (e.g. partial, css) indexed by name; an empty name would make the helper unreachable in templates.","triggerScenarios":"Calling hexo.extend.helper.register('', fn) or register(undefined, fn).","commonSituations":"A plugin registers helpers in a loop over an undefined map, or the helper name is read from a missing config key.","solutions":["Pass a non-empty helper name string.","Validate name presence before registering in loops.","Ensure the name does not collide with an empty key."],"exampleFix":"// before\nhexo.extend.helper.register(helperName, fn);\n// after\nif (helperName) hexo.extend.helper.register(helperName, fn);","handlingStrategy":"validation","validationCode":"if (!name) throw new Error('helper name required');\nhexo.extend.helper.register(name, fn);","typeGuard":"const isValidName = (n: unknown): n is string => typeof n === 'string' && n.length > 0;","tryCatchPattern":null,"preventionTips":["Register helpers from a typed map and assert keys are non-empty.","Use a shared helper-registration utility that validates names.","Test that each helper is reachable in templates after registration."],"tags":["helper","template","validation","plugin"],"backgroundTag":null,"analyzedSha":"059cb17494d0632a053c24077f5bcb6ae92acc51","analyzedAt":"2026-08-12T20:52:05.731Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}