{"record":{"id":"dc6f265cd2a3cc18","repo":"kovidgoyal/kitty","slug":"multiple-layouts-match-layout-name","errorCode":null,"errorMessage":"Multiple layouts match: {layout_name}","messagePattern":"Multiple layouts match: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/tabs.py","lineNumber":649,"sourceCode":"                matches.append(x)\n\n        if not matched_layout:\n            if len(prefix_matches) == 1:\n                matched_layout = prefix_matches[0]\n            elif len(matches) == 1:\n                matched_layout = matches[0]\n        if matched_layout:\n            self._set_current_layout(matched_layout)\n            self.relayout()\n        else:\n            if len(matches) == 0:\n                if raise_exception:\n                    raise ValueError(layout_name)\n                log_error(f'Unknown or disabled layout: {layout_name}')\n            elif len(matches) != 1:\n                if raise_exception:\n                    raise ValueError(layout_name)\n                log_error(f'Multiple layouts match: {layout_name}')\n\n    @ac(\n        'lay',\n        \"\"\"\n        Toggle the named layout\n\n        Switches to the named layout if another layout is current, otherwise\n        switches to the last used layout. Useful to \"zoom\" a window temporarily\n        by switching to the stack layout. See also :opt:`scrollback_fill_enlarged_window`\n        if you would like content from the scrollback buffer to scroll down into the\n        zoomed window. For example::\n\n            map f1 toggle_layout stack\n        \"\"\",\n    )\n    def toggle_layout(self, layout_name: str) -> None:\n        if self._current_layout_name == layout_name:\n            self.last_used_layout()","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/tabs.py#L631-L667","documentation":"goto_layout received an ambiguous name that prefixes multiple enabled layouts (kitty matches by unique prefix), so it refuses to switch and keeps the current layout.","triggerScenarios":"len(matches) != 1 with raise_exception=False — e.g. goto_layout('s') when both 'splits' and 'stack' are enabled.","commonSituations":"Short map bindings using a layout prefix that becomes ambiguous after enabling more layouts.","solutions":["Use the full layout name instead of an ambiguous prefix","Run kitten @get-enabled-layouts and choose a prefix unique among enabled layouts"],"exampleFix":"# before\nmap f1 goto_layout s\n\n# after\nmap f1 goto_layout splits","handlingStrategy":"validation","validationCode":"matches = [l for l in enabled_layouts if l.startswith(prefix)]\nassert len(matches) == 1, f'ambiguous layout prefix {prefix}: {matches}'","typeGuard":"def is_unambiguous_prefix(p: str, enabled: list[str]) -> bool:\n    return sum(l.startswith(p) for l in enabled) == 1","tryCatchPattern":null,"preventionTips":["Prefer full layout names over prefixes","When adding layouts to enabled_layouts, check existing prefix-based maps for new ambiguity"],"tags":["kitty","layouts","ambiguous-match"],"backgroundTag":"ambiguous-name-match","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}