{"record":{"id":"09b5ec0058a40d93","repo":"ethereum/go-ethereum","slug":"invalid-type","errorCode":null,"errorMessage":"invalid type","messagePattern":"invalid type","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"trie/stacktrie.go","lineNumber":331,"sourceCode":"\t\tp.children[origIdx] = newLeaf(st.key[diffidx+1:], st.val)\n\t\tt.hash(p.children[origIdx], append(path, st.key[:diffidx+1]...))\n\n\t\tnewIdx := key[diffidx]\n\t\tp.children[newIdx] = newLeaf(key[diffidx+1:], value)\n\n\t\t// Finally, cut off the key part that has been passed\n\t\t// over to the children.\n\t\tst.key = st.key[:diffidx]\n\t\tst.val = nil\n\n\tcase emptyNode: /* Empty */\n\t\t*st = *newLeaf(key, value)\n\n\tcase hashedNode:\n\t\tpanic(\"trying to insert into hash\")\n\n\tdefault:\n\t\tpanic(\"invalid type\")\n\t}\n}\n\n// hash converts st into a 'hashedNode', if possible. Possible outcomes:\n//\n// 1. The rlp-encoded value was >= 32 bytes:\n//   - Then the 32-byte `hash` will be accessible in `st.val`.\n//   - And the 'st.type' will be 'hashedNode'\n//\n// 2. The rlp-encoded value was < 32 bytes\n//   - Then the <32 byte rlp-encoded value will be accessible in 'st.val'.\n//   - And the 'st.type' will be 'hashedNode' AGAIN\n//\n// This method also sets 'st.type' to hashedNode, and clears 'st.key'.\nfunc (t *StackTrie) hash(st *stNode, path []byte) {\n\tvar blob []byte // RLP-encoded node blob\n\tswitch st.typ {\n\tcase hashedNode:","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/ethereum/go-ethereum/blob/6bb0588ad8e7f922e4ad5580f51265a4097af08f/trie/stacktrie.go#L313-L349","documentation":"Error \"invalid type\" thrown in ethereum/go-ethereum.","triggerScenarios":"StackTrie insert hitting a node whose type field is not one of the known internal node kinds.","commonSituations":"Memory corruption, concurrent misuse, or an internal stacktrie bug.","solutions":["The stacktrie node encountered an unknown internal type — an internal invariant violation. Ensure the StackTrie is used as intended (sorted, unique keys; no concurrent use) and report a bug if reachable with valid usage."],"exampleFix":"// Defensive panic: unreachable with correct StackTrie usage.\n// Verify keys are unique, sorted, and the trie is not shared across goroutines.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6bb0588ad8e7f922e4ad5580f51265a4097af08f","analyzedAt":"2026-08-15T10:06:53.996Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}