{"record":{"id":"b44cf54acf987a22","repo":"ssssssss-team/spider-flow","slug":"unrecognized-modifier-name-mod","errorCode":null,"errorMessage":"Unrecognized modifier name: \" + mod","messagePattern":"Unrecognized modifier name: \" \\+ mod","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"spider-flow-web/src/main/resources/static/js/codemirror/codemirror.js","lineNumber":6728,"sourceCode":"    \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n    \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n    \"fallthrough\": [\"basic\", \"emacsy\"]\n  };\n  keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n  // KEYMAP DISPATCH\n\n  function normalizeKeyName(name) {\n    var parts = name.split(/-(?!$)/);\n    name = parts[parts.length - 1];\n    var alt, ctrl, shift, cmd;\n    for (var i = 0; i < parts.length - 1; i++) {\n      var mod = parts[i];\n      if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }\n      else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n      else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n      else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n      else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n    }\n    if (alt) { name = \"Alt-\" + name; }\n    if (ctrl) { name = \"Ctrl-\" + name; }\n    if (cmd) { name = \"Cmd-\" + name; }\n    if (shift) { name = \"Shift-\" + name; }\n    return name\n  }\n\n  // This is a kludge to keep keymaps mostly working as raw objects\n  // (backwards compatibility) while at the same time support features\n  // like normalization and multi-stroke key bindings. It compiles a\n  // new normalized keymap, and then updates the old object to reflect\n  // this.\n  function normalizeKeyMap(keymap) {\n    var copy = {};\n    for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n      var value = keymap[keyname];\n      if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }","sourceCodeStart":6710,"sourceCodeEnd":6746,"githubUrl":"https://github.com/ssssssss-team/spider-flow/blob/c799cca99c7d064673dc79e6ef06a08bbc0e292d/spider-flow-web/src/main/resources/static/js/codemirror/codemirror.js#L6710-L6746","documentation":"CodeMirror normalizes key names like 'Cmd-X' or 'Shift-Alt-F' via lookupKey naming code; each dash-separated modifier token must match cmd/meta/m, a(lt), c/ctrl/control, or s(hift). Any other modifier token throws this error.","triggerScenarios":"Defining an extraKeys/keyMap entry with a misspelled or unsupported modifier, e.g. {'Option-S': fn}, {'Ctrl+Shift-N': fn} (plus signs not allowed), or localized/abbreviated modifiers like 'CmdOrCtrl' in normalizeKeyName paths.","commonSituations":"Porting keymaps from other editors (using 'Option', '+', 'Mod' in the wrong context), typos like 'Shfit-', or building key names dynamically from user input.","solutions":["Use only recognized modifiers: Cmd (Meta), Alt, Ctrl, Shift — e.g. 'Alt-Shift-F'","Replace '+' separators with '-' and 'Option' with 'Alt' (or 'Cmd' for Meta on macOS)","Use the special 'Mod-' prefix which maps to Cmd on macOS and Ctrl elsewhere"],"exampleFix":"// before\nextraKeys: {\"Option+Shift-F\": format}\n// after\nextraKeys: {\"Alt-Shift-F\": format}","handlingStrategy":"validation","validationCode":"var OK = /^(cmd|meta|m|a(lt)?|c|ctrl|control|s(hift)?)$/i;\nfunction keyIsValid(key) {\n  var parts = key.split(\"-\");\n  return parts.slice(0, -1).every(function(p) { return OK.test(p); });\n}\nif (!keyIsValid(userKey)) console.error(\"bad modifier in\", userKey);","typeGuard":null,"tryCatchPattern":"try {\n  extraKeys[normalizedKey] = handler;\n} catch (e) {\n  if (/Unrecognized modifier name/.test(e.message)) {\n    console.warn(\"Falling back: unknown key combo\", normalizedKey);\n  } else { throw e; }\n}","preventionTips":["Only use Cmd/Meta, Alt, Ctrl, Shift as modifiers, joined with '-'; use 'Mod-' for platform-neutral primary modifier","Never use '+' as a separator in CodeMirror key names","Sanitize any user-configurable keybindings through a whitelist before assigning to keyMap/extraKeys"],"tags":["codemirror","keybindings","keyboard"],"backgroundTag":"invalid-argument-format","analyzedSha":"c799cca99c7d064673dc79e6ef06a08bbc0e292d","analyzedAt":"2026-09-08T13:47:08.225Z","contentChangedAt":"2026-09-08T13:47:08.225Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}