TypeError: Assignment to constant variable

A variable declared with const already has its binding. JavaScript throws when later code tries to assign a different value to that same variable. Look for an assignment or an increment in the failing scope, then find the declaration it refers to.
Decide whether the variable needs to be rebound at all. A retry counter that changes after every attempt belongs in a let binding. If the code only updates properties of a mutable options object, keep the const binding and change the property directly.
const options = { theme: 'light' }; options.theme = 'dark'; // Mutate a property; do not reassign options let retries = 0; retries += 1;
Writing options.theme keeps the original object. Incrementing retries assigns a different number to its binding, which needs let. Look for that difference when the stack points to an assignment inside a larger expression.
Search the failing scope for writes to the binding, then rerun the branch that changes the value.