HandyOrg/HandyControl · warning

Label text must be defined!

Error message

Label text must be defined!

What it means

The NexT theme's label Hexo tag splits its arguments on '@' into a class and a text part, and warns when the text (the part after '@') is empty. The tag still renders an empty <span class="label ..."></span>. It signals a malformed tag call, not a hard failure.

Solutions

  1. Write the label as {% label class @ text %}, e.g. {% label primary @ Important %}.
  2. Ensure the '@' separator is present and followed by the label text.
  3. If you want the default class, start the argument with '@': {% label @ My text %}.

Example fix

// before
{% label primary %}
// after
{% label primary @ Important note %}
Defensive patterns

Strategy: validation

Validate before calling

function checkLabelArgs(rawArgs) {
  const parts = rawArgs.join(' ').split('@');
  const text = parts[1];
  if (!text || !text.trim()) {
    console.warn('{% label %} requires text after "@", e.g. {% label primary @ text %}');
    return false;
  }
  return true;
}

Type guard

function hasLabelText(args) {
  const parts = args.join(' ').split('@');
  return typeof parts[1] === 'string' && parts[1].trim().length > 0;
}

Prevention

When it happens

Trigger: {% label @some text %} (no class given, and text contains no further '@') is fine, but writing {% label primary %} — where '@' is missing so args[1] is undefined — or {% label primary @ %} with nothing after '@' triggers the warning.

Common situations: Authors forgetting the '@' separator between label color class and text, or copying an example where the class was omitted leaving only one argument.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of HandyOrg/HandyControl@2c0875ebd6 (2026-09-14). Data as JSON: /api/errors/ace6c5a78a378830. Report an issue: GitHub.

Appendix: source

Thrown at doc/themes/next/scripts/tags/label.js:14

/**
 * label.js | https://theme-next.org/docs/tag-plugins/label
 */

/* global hexo */

'use strict';

function postLabel(args) {
  args = args.join(' ').split('@');
  var classes = args[0] || 'default';
  var text    = args[1] || '';

  !text && hexo.log.warn('Label text must be defined!');

  return `<span class="label ${classes.trim()}">${text}</span>`;
}

hexo.extend.tag.register('label', postLabel, {ends: false});

View on GitHub (pinned to 2c0875ebd6)