octobercms/october · error · Error

The request handler name is not specified.

Error message

The request handler name is not specified.

What it means

Thrown by the Options constructor (request/options.js) in October CMS's AJAX framework. Every AJAX request must name a server-side handler; Options is constructed for each oc.request()/oc.ajax() call, and a falsy handler (empty string, null, undefined) aborts immediately with this message.

Source

Thrown at modules/system/assets/js/framework.js:324

          }
        }
      }
      return out;
    }
    getRedirectUrl() {
      const op = this.getOps("redirect")[0];
      return op?.url || this.redirect || null;
    }
    getReload() {
      return this.getOps("reload")[0] || null;
    }
  };

  // ../../vendor/larajax/larajax/resources/src/request/options.js
  var Options = class {
    constructor(handler, options) {
      if (!handler) {
        throw new Error("The request handler name is not specified.");
      }
      if (!handler.match(/^(?:\w+\:{2})?on*/)) {
        throw new Error('Invalid handler name. The correct handler name format is: "onEvent".');
      }
      if (typeof FormData === "undefined") {
        throw new Error("The browser does not support the FormData interface.");
      }
      this.options = options;
      this.handler = handler;
    }
    static fetch(handler, options) {
      return new this(handler, options).getRequestOptions();
    }
    // Public
    getRequestOptions() {
      return {
        method: "POST",
        url: this.options.url ? this.options.url : window.location.href,

View on GitHub (pinned to b608633a7e)

Solutions

  1. Pass the handler explicitly: oc.request(el, 'onSubmit', options)
  2. Or add the attribute: <form data-request="onSubmit"> so getHandlerName() can find it
  3. If the handler comes from a variable, default it: oc.request(el, handler || 'onSubmit')
  4. Ensure the element is actually inside the [data-request] subtree when relying on inheritance

Example fix

// before
oc.request(form);

// after
oc.request(form, 'onSubmit');
// or in markup: <form data-request="onSubmit" ...>
Defensive patterns

Strategy: validation

Validate before calling

function requestTargetReady(el, handler) {
  const h = handler || el?.closest('[data-request]')?.getAttribute('data-request');
  return Boolean(h);
}

if (requestTargetReady(form, handler)) oc.request(form, handler);

Type guard

const hasHandler = (el) => !!(el && (el.dataset.request || el.closest('[data-request]')));

Try / catch

try { oc.request(el, handler); } catch (e) { if (/handler name is not specified/.test(e.message)) { console.error('Add data-request or pass an on* handler'); return; } throw e; }

Prevention

When it happens

Trigger: oc.ajax('', {update: {...}}) with an empty handler; oc.request(el) where el is not inside a [data-request] element and no handler argument is given (getHandlerName() finds no data-request attribute); dynamically passing a handler variable that is undefined at call time.

Common situations: Calling oc.request(element) without arguments on an element missing data-request; refactoring code so the handler variable is undefined; copy-pasted markup missing the data-request attribute; forms relying on a parent's data-request where the element is outside that subtree.

Related errors


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/b5b30eece4e2660d. Report an issue: GitHub.