ssssssss-team/spider-flow · error · Error

Inconsistent bindings for " + name

Error message

Inconsistent bindings for " + name

What it means

CodeMirror's keymap normalization builds composite bindings like 'Ctrl-X Ctrl-C' and detects when the same prefix name maps to two different values ('...' continuation vs an actual command). Conflicting definitions for the same key sequence throw this error.

Solutions

  1. Remove or rename the conflicting key so a prefix is either a command or a continuation, not both
  2. Namespace one plugin's bindings under a different first key to avoid collisions
  3. Merge keymaps consciously: pick one value for the colliding prefix before normalizing

Example fix

// before
var map = {"Ctrl-X": quit, "Ctrl-X Ctrl-S": save}; // conflict
// after
var map = {"Ctrl-Q": quit, "Ctrl-X Ctrl-S": save};
Defensive patterns

Strategy: validation

Validate before calling

function checkMultiStrokeConflicts(keymap) {
  var prefixes = {};
  for (var key in keymap) {
    var parts = key.split(" ");
    for (var i = 1; i < parts.length; i++) {
      var prefix = parts.slice(0, i).join(" ");
      if (keymap[prefix] && keymap[prefix] !== "...") return prefix;
      prefixes[prefix] = true;
    }
  }
  return null;
}
var conflict = checkMultiStrokeConflicts(myKeymap);

Try / catch

try {
  var map = CodeMirror.normalizeKeyMap(rawMap);
} catch (e) {
  if (/Inconsistent bindings/.test(e.message)) {
    var map = CodeMirror.normalizeKeyMap(Object.assign({}, rawMap, conflictedPrefixRemoved));
  } else { throw e; }
}

Prevention

When it happens

Trigger: Adding two entries to an keyMap whose multi-stroke prefixes collide, e.g. {'Ctrl-X': fn1, 'Ctrl-X Ctrl-C': fn2} — 'Ctrl-X' would need to be both a command and a '...' continuation — or nested keymaps flattened by normalizeKeyMap with inconsistent prefixes.

Common situations: Merging several keymap objects (plugin keymaps + user keymaps) where both define overlapping multi-key sequences, or hand-writing normalizeKeyMap input with a prefix that is also a final binding.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of ssssssss-team/spider-flow@c799cca99c (2026-09-08). Data as JSON: /api/errors/d948299d6785e967. Report an issue: GitHub.

Appendix: source

Thrown at spider-flow-web/src/main/resources/static/js/codemirror/codemirror.js:6761

    var copy = {};
    for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
      var value = keymap[keyname];
      if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
      if (value == "...") { delete keymap[keyname]; continue }

      var keys = map(keyname.split(" "), normalizeKeyName);
      for (var i = 0; i < keys.length; i++) {
        var val = (void 0), name = (void 0);
        if (i == keys.length - 1) {
          name = keys.join(" ");
          val = value;
        } else {
          name = keys.slice(0, i + 1).join(" ");
          val = "...";
        }
        var prev = copy[name];
        if (!prev) { copy[name] = val; }
        else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
      }
      delete keymap[keyname];
    } }
    for (var prop in copy) { keymap[prop] = copy[prop]; }
    return keymap
  }

  function lookupKey(key, map$$1, handle, context) {
    map$$1 = getKeyMap(map$$1);
    var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
    if (found === false) { return "nothing" }
    if (found === "...") { return "multi" }
    if (found != null && handle(found)) { return "handled" }

    if (map$$1.fallthrough) {
      if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
        { return lookupKey(key, map$$1.fallthrough, handle, context) }
      for (var i = 0; i < map$$1.fallthrough.length; i++) {

View on GitHub (pinned to c799cca99c)