{"record":{"id":"9edbb2aaf164fc95","repo":"pentaho/pentaho-kettle","slug":"pentaho-i18n-bundle-path-argument-cannot-be-a-single","errorCode":null,"errorMessage":"[pentaho/i18n!] Bundle path argument cannot be a single '/'.","messagePattern":"\\[pentaho/i18n!\\] Bundle path argument cannot be a single '/'\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/i18n/defaultService.js","lineNumber":72,"sourceCode":"        });\n      }\n    },\n    normalize: function(name, normalize) {\n      return normalize(__getBundleID(name));\n    }\n  };\n\n  function __getBundleID(bundlePath) {\n    var bundleMid;\n    if(!bundlePath) {\n      // \"pentaho/i18n!\"\n      // Use the default location and bundle.\n      bundleMid = \"./i18n/messages\";\n    } else if(bundlePath[0] === \"/\") {\n      // \"pentaho/i18n!/pentaho/common/nls/messages\"\n      // The path is, directly, an absolute module id of a message bundle (without the /).\n      bundleMid = bundlePath.substr(1);\n      if(!bundleMid) throw new Error(\"[pentaho/i18n!] Bundle path argument cannot be a single '/'.\");\n    } else if(bundlePath[0] !== \".\" && bundlePath.indexOf(\"/\") < 0) {\n\n      // the name of a bundle in the default \"./i18n\" sub-module\n      bundleMid = \"./i18n/\" + bundlePath;\n    } else {\n      // \"pentaho/i18n!./nls/information\"\n      // The path is, directly, a relative module id of a message bundle\n      // Or the path has already been resolved by RequireJS.\n      bundleMid = bundlePath;\n    }\n\n    return bundleMid;\n  }\n\n  function __parseProperties(text) {\n    // \"Brute\" parsing.\n    var lines = text.split(/[\\n\\r]+/);\n    var props = {};","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/i18n/defaultService.js#L54-L90","documentation":"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.","triggerScenarios":"Calling require(['pentaho/i18n!/']) or writing pentaho/i18n!/ in a module dependency list — i.e. passing a lone slash as the bundle path.","commonSituations":"String concatenation building loader paths like 'pentaho/i18n!' + absolutePath where absolutePath is empty, leaving only '/'; template/config values where the bundle segment was lost.","solutions":["Provide a real absolute module id, e.g. pentaho/i18n!/pentaho/common/nls/messages (leading slash optional after the !)","Check the code building the path — a variable holding the bundle path is empty","Validate/strip the argument before requiring the loader module"],"exampleFix":"// before\nrequire(['pentaho/i18n!/' + bundlePath], function(bundle) {...}); // bundlePath === '' -> '!/'\n// after\nvar mid = bundlePath ? 'pentaho/i18n!/' + bundlePath : 'pentaho/i18n!/pentaho/common/nls/messages';\nrequire([mid], function(bundle) {...});","handlingStrategy":"validation","validationCode":"var path = String(bundlePath || '');\nif (path === '/' || !path) throw new Error('pentaho/i18n! requires a non-empty bundle path');","typeGuard":"function isUsableBundlePath(p) { return typeof p === 'string' && p.length > 0 && p !== '/'; }","tryCatchPattern":"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; }","preventionTips":["When concatenating loader ids, assert the path segment is non-empty","Normalize absolute paths: strip or keep the leading '/' consistently","Add a unit test requiring each i18n! module id used in the app"],"tags":["i18n","amd-loader","invalid-argument"],"backgroundTag":"invalid-argument-format","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}