{"record":{"id":"bdc2adee8dde59b9","repo":"amark/gun","slug":"not-tag-in-a","errorCode":null,"errorMessage":"not tag in ${a}","messagePattern":"not tag in (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/normalize.js","lineNumber":63,"sourceCode":"      'em': 'i', 'strong': 'b', 'strike': 's',\n    }\n    ,attrs: {\n      'id':1\n      ,'class':1\n      ,'style':1\n    }\n    ,blockTag: function(a){\n      return a.opt.tags[a.tag].order < a.opt.tags.a.order;\n    }\n    ,mutate: [exclude, moveSpaceUp, next, parentOrderWrap]\n  }\n\n  var defaultOpt = prepareOptTags($.extend(true, {}, baseOpt));\n\n  var unstableList = [];\n\n  function addUnstable(a) { // NOT ES5\n    if(!a.tag) { throw Error(\"not tag in \", a) }\n    if(a.unstable) return;\n    unstableList.push(a);\n    a.unstable = true;\n  }\n\n  function initTag(a) {\n    // initial handling (container, convert, attributes):\n    a.tag = tag(a.$);\n      if(empty(a)) {\n      return;\n    }\n    parseAndRemoveAttrs(a);\n    convert(a);\n    setAttrs(a);\n    a.$[0].a = a; // link from dom element back to a\n    // state machine init\n    unstableList.push(a);\n    a.unstable = true;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/amark/gun/blob/552227599d47ba0493824b7fcf8a00c8cd6404ba/lib/normalize.js#L45-L81","documentation":"In lib/normalize.js (jquery-normalize), addUnstable is a callback passed into the mutation functions (exclude, next, parentOrderWrap) that re-queues a node's wrapper object `a` into the unstable list. Before queueing it asserts that the wrapper has a `tag` property; if `a.tag` is missing/falsy it throws 'not tag in '. Note the arguments to Error() are not interpolated, so the message literally reads 'not tag in ' — the offending object `a` is passed as a second, ignored argument.","triggerScenarios":"A mutation function (exclude, next, or parentOrderWrap) calls addUnstable with an object `a` that never went through initTag, or whose `tag` was never assigned (initTag sets a.tag = tag(a.$); empty nodes return early before a.tag gets fully set up in the state machine path). Typically caused by custom/misconfigured opt.mutate hooks or DOM structures that bypass initTag.","commonSituations":"Custom normalize options supplying mutate functions that enqueue their own wrappers without a tag; HTML containing empty elements (empty(a) returns early in initTag, leaving a.tag unset) later manipulated by mutations; bugs after refactoring the internal state machine.","solutions":["Ensure every object passed to addUnstable went through initTag so a.tag is set.","Check for empty elements (br, img) in the HTML being normalized — initTag returns early for them; don't re-queue their wrappers from custom mutations.","If you supply custom opt.mutate functions, only call addUnstable on wrappers that already have a tag.","Log the object before throwing (Error arguments beyond the first are ignored) to identify the offending node: temporarily change the throw to include JSON.stringify(a).","Upgrade/patch the library — the message construction is buggy (comma instead of concatenation) which hides which tag caused it."],"exampleFix":"// before\\nif(!a.tag) { throw Error(\"not tag in \", a) }\\n// after\\nif(!a.tag) { throw Error(\"not tag in \" + JSON.stringify(a && a.$ && a.$[0] && a.$[0].outerHTML)) }","handlingStrategy":"type-guard","validationCode":"// Guard wrappers before any custom mutate hook re-queues them\\nfunction canEnqueue(a){ return a && typeof a === 'object' && a.$ && a.$[0] && !!a.tag; }\\n// only call addUnstable when canEnqueue(a) is true","typeGuard":"function hasTag(a){ return a != null && typeof a === 'object' && typeof a.tag === 'string' && a.tag.length > 0; }","tryCatchPattern":"try {\\n  $.normalize(html, opt);\\n} catch (e) {\\n  if (/^not tag in/.test(e.message)) {\\n    console.error('normalize state machine hit a wrapper without a tag — check empty elements or custom mutate hooks');\\n  } else { throw e; }\\n}","preventionTips":["Don't call addUnstable on wrappers that skipped initTag (empty tags like br/img return early).","When writing custom opt.mutate functions, only re-queue objects produced by initTag.","Include the node's outerHTML in error logs — Error() ignores extra args, so augment the message locally.","Keep HTML input free of malformed/empty edge-case elements, or handle them in mutations."],"tags":["dom","normalization","internal-state","jquery"],"backgroundTag":"missing-tag-property","analyzedSha":"552227599d47ba0493824b7fcf8a00c8cd6404ba","analyzedAt":"2026-09-02T18:40:58.370Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}