{"record":{"id":"055dd297ac9b992c","repo":"bettercap/bettercap","slug":"root-segment-cannot-have-matrix-parameters","errorCode":null,"errorMessage":"Root segment cannot have matrix parameters","messagePattern":"Root segment cannot have matrix parameters","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/ui/ui/vendor.js","lineNumber":76718,"sourceCode":"function replaceSegment(current, oldSegment, newSegment) {\n    var children = {};\n    forEach(current.children, function (c, outletName) {\n        if (c === oldSegment) {\n            children[outletName] = newSegment;\n        }\n        else {\n            children[outletName] = replaceSegment(c, oldSegment, newSegment);\n        }\n    });\n    return new UrlSegmentGroup(current.segments, children);\n}\nvar Navigation = /** @class */ (function () {\n    function Navigation(isAbsolute, numberOfDoubleDots, commands) {\n        this.isAbsolute = isAbsolute;\n        this.numberOfDoubleDots = numberOfDoubleDots;\n        this.commands = commands;\n        if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {\n            throw new Error('Root segment cannot have matrix parameters');\n        }\n        var cmdWithOutlet = commands.find(function (c) { return typeof c === 'object' && c != null && c.outlets; });\n        if (cmdWithOutlet && cmdWithOutlet !== last$1(commands)) {\n            throw new Error('{outlets:{}} has to be the last command');\n        }\n    }\n    Navigation.prototype.toRoot = function () {\n        return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/';\n    };\n    return Navigation;\n}());\n/** Transforms commands to a normalized `Navigation` */\nfunction computeNavigation(commands) {\n    if ((typeof commands[0] === 'string') && commands.length === 1 && commands[0] === '/') {\n        return new Navigation(true, 0, commands);\n    }\n    var numberOfDoubleDots = 0;\n    var isAbsolute = false;","sourceCodeStart":76700,"sourceCodeEnd":76736,"githubUrl":"https://github.com/bettercap/bettercap/blob/8eca2820f3c41d2004434ed5a291d87462caeeb7/modules/ui/ui/vendor.js#L76700-L76736","documentation":"When building navigation commands, the first command of an absolute navigation may not carry matrix parameters, because matrix params attach to segments and the root segment has none. This throw is the guard in the Navigation constructor rejecting commands like [{foo:'bar'}, '/path'] passed to router.navigate with absolute positioning.","triggerScenarios":"Thrown at modules/ui/ui/vendor.js:76718 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Move matrix parameters to a segment after the root, not as the first command of an absolute navigation","Use queryParams instead of matrix params if the intent is query-string values","Navigate relatively (without a leading '/'' path-root command) if params must attach to the current segment"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8eca2820f3c41d2004434ed5a291d87462caeeb7","analyzedAt":"2026-09-02T12:49:00.712Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}