[{"data":1,"prerenderedAt":245},["ShallowReactive",2],{"term-r\u002Fruntime-error":3,"related-r\u002Fruntime-error":228},{"id":4,"title":5,"acronym":6,"body":7,"category":209,"description":210,"difficulty":211,"extension":212,"letter":213,"meta":214,"navigation":105,"path":215,"related":216,"seo":222,"sitemap":223,"stem":226,"subcategory":6,"__hash__":227},"terms\u002Fterms\u002Fr\u002Fruntime-error.md","Runtime Error",null,{"type":8,"value":9,"toc":203},"minimark",[10,15,19,23,26,30,192,196,199],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"A runtime error is one that only shows up when your program is actually running, not before. The code looks fine to the computer, it starts running, then boom — it hits something it cannot handle, like trying to open a door that is not there. The classic example: accessing a property on null.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"A runtime error occurs during program execution after the code has been successfully parsed and compiled. These errors arise from operations that cannot be performed at runtime — dividing by zero, accessing an undefined property, out-of-bounds array access, or network failures. In dynamically typed languages, many type errors are runtime errors since types are not checked until execution.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F This looks fine syntactically but fails at runtime:\nconst users = null; \u002F\u002F maybe from a failed API call\nconsole.log(users.length);\n\u002F\u002F TypeError: Cannot read properties of null (reading 'length')\n\n\u002F\u002F Runtime error from invalid operation:\nconst result = 10 \u002F 0; \u002F\u002F Infinity in JS, crash in some other languages\n\n\u002F\u002F Fix: always guard against null:\nconst users = null;\nconsole.log(users?.length ?? 0); \u002F\u002F safe with optional chaining\n","javascript","",[38,39,40,49,70,94,100,107,113,139,144,150,162],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F This looks fine syntactically but fails at runtime:\n",[41,50,52,56,60,64,67],{"class":43,"line":51},2,[41,53,55],{"class":54},"spNyl","const",[41,57,59],{"class":58},"sTEyZ"," users ",[41,61,63],{"class":62},"sMK4o","=",[41,65,66],{"class":62}," null;",[41,68,69],{"class":47}," \u002F\u002F maybe from a failed API call\n",[41,71,73,76,79,83,86,88,91],{"class":43,"line":72},3,[41,74,75],{"class":58},"console",[41,77,78],{"class":62},".",[41,80,82],{"class":81},"s2Zo4","log",[41,84,85],{"class":58},"(users",[41,87,78],{"class":62},[41,89,90],{"class":58},"length)",[41,92,93],{"class":62},";\n",[41,95,97],{"class":43,"line":96},4,[41,98,99],{"class":47},"\u002F\u002F TypeError: Cannot read properties of null (reading 'length')\n",[41,101,103],{"class":43,"line":102},5,[41,104,106],{"emptyLinePlaceholder":105},true,"\n",[41,108,110],{"class":43,"line":109},6,[41,111,112],{"class":47},"\u002F\u002F Runtime error from invalid operation:\n",[41,114,116,118,121,123,127,130,133,136],{"class":43,"line":115},7,[41,117,55],{"class":54},[41,119,120],{"class":58}," result ",[41,122,63],{"class":62},[41,124,126],{"class":125},"sbssI"," 10",[41,128,129],{"class":62}," \u002F",[41,131,132],{"class":125}," 0",[41,134,135],{"class":62},";",[41,137,138],{"class":47}," \u002F\u002F Infinity in JS, crash in some other languages\n",[41,140,142],{"class":43,"line":141},8,[41,143,106],{"emptyLinePlaceholder":105},[41,145,147],{"class":43,"line":146},9,[41,148,149],{"class":47},"\u002F\u002F Fix: always guard against null:\n",[41,151,153,155,157,159],{"class":43,"line":152},10,[41,154,55],{"class":54},[41,156,59],{"class":58},[41,158,63],{"class":62},[41,160,161],{"class":62}," null;\n",[41,163,165,167,169,171,173,176,179,182,184,187,189],{"class":43,"line":164},11,[41,166,75],{"class":58},[41,168,78],{"class":62},[41,170,82],{"class":81},[41,172,85],{"class":58},[41,174,175],{"class":62},"?.",[41,177,178],{"class":58},"length ",[41,180,181],{"class":62},"??",[41,183,132],{"class":125},[41,185,186],{"class":58},")",[41,188,135],{"class":62},[41,190,191],{"class":47}," \u002F\u002F safe with optional chaining\n",[11,193,195],{"id":194},"when-youll-hear-this","When You'll Hear This",[16,197,198],{},"\"It passed linting but threw a runtime error in production.\" \u002F \"Runtime errors are harder to catch because you need to actually run the code.\"",[200,201,202],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":51,"depth":51,"links":204},[205,206,207,208],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":194,"depth":51,"text":195},"general","A runtime error is one that only shows up when your program is actually running, not before.","beginner","md","r",{},"\u002Fterms\u002Fr\u002Fruntime-error",[217,218,219,220,221],"Syntax Error","Logic Error","Bug","Exception","Null",{"title":5,"description":210},{"changefreq":224,"priority":225},"weekly",0.7,"terms\u002Fr\u002Fruntime-error","Wk6X545EQVEV22c-KXbynHMNVo8l80GgGHYcYeWlDyU",[229,232,236,239,242],{"title":219,"path":230,"acronym":6,"category":209,"difficulty":211,"description":231},"\u002Fterms\u002Fb\u002Fbug","A bug is anything in your code that makes it behave wrong.",{"title":220,"path":233,"acronym":6,"category":209,"difficulty":234,"description":235},"\u002Fterms\u002Fe\u002Fexception","intermediate","An exception is a special kind of error that 'throws' itself up through your code like a hot potato, looking for someone to catch it.",{"title":218,"path":237,"acronym":6,"category":209,"difficulty":211,"description":238},"\u002Fterms\u002Fl\u002Flogic-error","A logic error is the sneakiest kind of bug — the code runs perfectly fine, no crashes, no errors, but it does the WRONG thing.",{"title":221,"path":240,"acronym":6,"category":209,"difficulty":211,"description":241},"\u002Fterms\u002Fn\u002Fnull","Null means 'intentionally nothing' — a programmer chose to say 'there is no value here'. It is a deliberate absence.",{"title":217,"path":243,"acronym":6,"category":209,"difficulty":211,"description":244},"\u002Fterms\u002Fs\u002Fsyntax-error","A syntax error is when you write code that the computer cannot even understand — like handing someone a sentence with no verbs.",1776518309299]