pentaho/pentaho-kettle · error · Error

[pentaho/i18n!] Bundle path argument cannot be a single '/'.

Error message

[pentaho/i18n!] Bundle path argument cannot be a single '/'.

What it means

The pentaho/i18n AMD loader plugin resolves its bundle path argument to a message bundle module id in __getBundleID. When the path starts with '/', it is treated as an absolute module id after stripping the leading slash; if the argument was just '/', nothing remains and a plain Error is thrown because the bundle id would be empty.

Solutions

  1. Provide a real absolute module id, e.g. pentaho/i18n!/pentaho/common/nls/messages (leading slash optional after the !)
  2. Check the code building the path — a variable holding the bundle path is empty
  3. Validate/strip the argument before requiring the loader module

Example fix

// before
require(['pentaho/i18n!/' + bundlePath], function(bundle) {...}); // bundlePath === '' -> '!/'
// after
var mid = bundlePath ? 'pentaho/i18n!/' + bundlePath : 'pentaho/i18n!/pentaho/common/nls/messages';
require([mid], function(bundle) {...});
Defensive patterns

Strategy: validation

Validate before calling

var path = String(bundlePath || '');
if (path === '/' || !path) throw new Error('pentaho/i18n! requires a non-empty bundle path');

Type guard

function isUsableBundlePath(p) { return typeof p === 'string' && p.length > 0 && p !== '/'; }

Try / catch

try { var bundle = require('pentaho/i18n!' + path); } catch (e) { if (e.message.indexOf('cannot be a single') >= 0) { bundle = require('pentaho/i18n!./i18n/messages'); } else throw e; }

Prevention

When it happens

Trigger: Calling require(['pentaho/i18n!/']) or writing pentaho/i18n!/ in a module dependency list — i.e. passing a lone slash as the bundle path.

Common situations: String concatenation building loader paths like 'pentaho/i18n!' + absolutePath where absolutePath is empty, leaving only '/'; template/config values where the bundle segment was lost.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/9edbb2aaf164fc95. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core-ui/src/main/resources/app/pentaho/i18n/defaultService.js:72

        });
      }
    },
    normalize: function(name, normalize) {
      return normalize(__getBundleID(name));
    }
  };

  function __getBundleID(bundlePath) {
    var bundleMid;
    if(!bundlePath) {
      // "pentaho/i18n!"
      // Use the default location and bundle.
      bundleMid = "./i18n/messages";
    } else if(bundlePath[0] === "/") {
      // "pentaho/i18n!/pentaho/common/nls/messages"
      // The path is, directly, an absolute module id of a message bundle (without the /).
      bundleMid = bundlePath.substr(1);
      if(!bundleMid) throw new Error("[pentaho/i18n!] Bundle path argument cannot be a single '/'.");
    } else if(bundlePath[0] !== "." && bundlePath.indexOf("/") < 0) {

      // the name of a bundle in the default "./i18n" sub-module
      bundleMid = "./i18n/" + bundlePath;
    } else {
      // "pentaho/i18n!./nls/information"
      // The path is, directly, a relative module id of a message bundle
      // Or the path has already been resolved by RequireJS.
      bundleMid = bundlePath;
    }

    return bundleMid;
  }

  function __parseProperties(text) {
    // "Brute" parsing.
    var lines = text.split(/[\n\r]+/);
    var props = {};

View on GitHub (pinned to f3058517a1)